Cannot set text in view pager
My viewpager works fine but am now trying to add a textview on top of the image in my viewpager so the text is 'attached' to the pager. I can define the textview fine but when I try to setText() it returns a null pointer exception on this line: score.setText("TEST");
Here is the code for my adapter.

      private class MyPagerAdapter extends PagerAdapter {

		public int getCount() {
			return 5;
		}

		public Object instantiateItem(View collection, int position) {
			
			LayoutInflater inflater = (LayoutInflater) collection.getContext()
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);			
			
			int resId = 0;
			switch (position) {
			case 0:
				resId = R.layout.farleft;
				
				score = (TextView) findViewById(R.id.textView1);
				**EXCEPTION HERE**		score.setText("TEST");
				
				break;
			case 1:
				resId = R.layout.left;
				break;
			case 2:
				resId = R.layout.middle;
				break;
			case 3:
				resId = R.layout.right;
				break;
			case 4:
				resId = R.layout.farright;
				break;
			}
			 
			View view = inflater.inflate(resId, null);
			view.setTag(position);
			
			view.setOnClickListener(new OnClickListener() {
				public void onClick(View view) {
					
					int position = (Integer) view.getTag();
					Log.v("Log_tag", "Here image is clicked" + position);
					
					if(position == 0){
						Intent intent = new Intent(LogoQuizActivity.this,
								LevelOne.class);
						startActivity(intent);
						
					}
					
					if(position == 1){
						Intent intent = new Intent(getBaseContext(),
								LevelTwo.class);
						startActivity(intent);
					}
					
					if(position == 2){
						Intent intent = new Intent(getBaseContext(),
								LevelThree.class);
						startActivity(intent);
					}
					
					if(position == 3){
						Intent intent = new Intent(getBaseContext(),
								LevelFour.class);
						startActivity(intent);
					}
					
					if(position == 4){
						Intent intent = new Intent(getBaseContext(),
								LevelFive.class);
						startActivity(intent);
					}
				}
			});
			

			((ViewPager) collection).addView(view, 0);
			
			return view;
			

		}

Cannot set text in view pager
===

My viewpager works fine but am now trying to add a textview on top of the image in my viewpager so the text is 'attached' to the pager. I can define the textview fine but when I try to setText() it returns a null pointer exception on this line: score.setText("TEST");
Here is the code for my adapter.

      private class MyPagerAdapter extends PagerAdapter {

		public int getCount() {
			return 5;
		}

		public Object instantiateItem(View collection, int position) {
			
			LayoutInflater inflater = (LayoutInflater) collection.getContext()
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);			
			
			int resId = 0;
			switch (position) {
			case 0:
				resId = R.layout.farleft;
				
				score = (TextView) findViewById(R.id.textView1);
				**EXCEPTION HERE**		score.setText("TEST");
				
				break;
			case 1:
				resId = R.layout.left;
				break;
			case 2:
				resId = R.layout.middle;
				break;
			case 3:
				resId = R.layout.right;
				break;
			case 4:
				resId = R.layout.farright;
				break;
			}
			 
			View view = inflater.inflate(resId, null);
			view.setTag(position);
			
			view.setOnClickListener(new OnClickListener() {
				public void onClick(View view) {
					
					int position = (Integer) view.getTag();
					Log.v("Log_tag", "Here image is clicked" + position);
					
					if(position == 0){
						Intent intent = new Intent(LogoQuizActivity.this,
								LevelOne.class);
						startActivity(intent);
						
					}
					
					if(position == 1){
						Intent intent = new Intent(getBaseContext(),
								LevelTwo.class);
						startActivity(intent);
					}
					
					if(position == 2){
						Intent intent = new Intent(getBaseContext(),
								LevelThree.class);
						startActivity(intent);
					}
					
					if(position == 3){
						Intent intent = new Intent(getBaseContext(),
								LevelFour.class);
						startActivity(intent);
					}
					
					if(position == 4){
						Intent intent = new Intent(getBaseContext(),
								LevelFive.class);
						startActivity(intent);
					}
				}
			});
			

			((ViewPager) collection).addView(view, 0);
			
			return view;
			

		}
