how to play music in both farward and backward directions using mediaplyer in android
here i need to display some images in to gallery,at the same time when the image visable that time i need to display that image related sound also. i did that one using mediaplayer.its working fine in emulater.but in phones,tablets its not working scrolling images that time am getting error like fatelexception:main nullpointer exception,whats the prblm i dnt knw.please any one suggest me.....


           HomE .class:
           public class HomE extends Activity implements
           AdapterView.OnItemSelectedListener, ViewSwitcher.ViewFactory{
	private TextSwitcher mSwitcher;
	private TextSwitcher mSwitcher3;
	private TextSwitcher mSwitcher7;
	ImageButton home, sound;
	Gallery g;
	static int nextbtn = 0;
	static int prebtn = 0;
	ImageAdapter iadapter;
	int galpos;
	int countk1 = 0;
	int countk2;
	int countk3 = 0;
	int countk4 = 0;
	int count111 = 0;
	int count111i = 0;
	int count111l = 0;
	int count111s = 0;
	public static int countin,counti,countl,counts;
	public static int countin1=0;
	public static int countini=0;
	public static int countinl=0;
	public static int countins=0;
	public int ht;
	public int wt;
	MediaPlayer intro1, intro2, intro3, intro4, intro5, intro6, intro7, intro8,
	intro9, intro10, intro11, intro12, intro13;
	
	public static int motiongal = 3000;
	RelativeLayout l1, l2;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.home1);
        intro1 = MediaPlayer.create(this, R.raw.abcsongnorwegianonlymusic);
		intro2 = MediaPlayer.create(this, R.raw.bokstavslottet_2);
		intro3 = MediaPlayer.create(this, R.raw.bokstavslottet_3);
		intro4 = MediaPlayer.create(this, R.raw.bokstavslottet_4);
		intro5 = MediaPlayer.create(this, R.raw.bokstavslottet_5);
		intro6 = MediaPlayer.create(this, R.raw.bokstavslottet_6);
		intro7 = MediaPlayer.create(this, R.raw.bokstavslottet_7);
		intro8 = MediaPlayer.create(this, R.raw.bokstavslottet_8);
		intro9 = MediaPlayer.create(this, R.raw.bokstavslottet_9);
		intro10 = MediaPlayer.create(this, R.raw.bokstavslottet_10);
		intro11 = MediaPlayer.create(this, R.raw.bokstavslottet_11);
		intro12 = MediaPlayer.create(this, R.raw.bokstavslottet_12);
		intro13 = MediaPlayer.create(this, R.raw.bokstavslottet_13);
		
		
		
		home = (ImageButton) findViewById(R.id.homeimage);
		home.setOnTouchListener(new OnTouchListener() {

			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				Intent i = new Intent(HomE.this, HomeDEmo.class);
				startActivity(i);
				return false;
			}
		});
		sound = (ImageButton) findViewById(R.id.soundimage);
		sound.setOnTouchListener(new OnTouchListener() {

			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				return false;
			}
		});
		DisplayMetrics displaymetrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
		ht = displaymetrics.heightPixels;
		wt = displaymetrics.widthPixels;
		l1 = (RelativeLayout) findViewById(R.id.linear);
		l2 = (RelativeLayout) findViewById(R.id.linear1);
		l1.setVisibility(View.INVISIBLE);
		l2.setOnTouchListener(new OnTouchListener() {

			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				l1.setVisibility(View.VISIBLE);
				final Handler handler = new Handler();
				handler.postDelayed(new Runnable() {
					public void run() {
						// Do something after 100ms
						l1.setVisibility(View.INVISIBLE);
					}
				}, 1500);
				return false;
			}
		});
		mSwitcher = (TextSwitcher) findViewById(R.id.switcher);
		mSwitcher.setFactory(this);
		mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_in));
		mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_out));
		mSwitcher.startLayoutAnimation();
		mSwitcher3 = (TextSwitcher) findViewById(R.id.switcher3);
		mSwitcher3.setFactory(this);
		mSwitcher3.setInAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_in));
		mSwitcher3.setOutAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_out));
		mSwitcher3.startLayoutAnimation();
		
		mSwitcher7 = (TextSwitcher) findViewById(R.id.switcher7);
		mSwitcher7.setFactory(this);
		mSwitcher7.setInAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_in));
		mSwitcher7.setOutAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_out));
		mSwitcher7.startLayoutAnimation();
		
		 countin = getIntent().getIntExtra("a1", 0); 
		 counti = getIntent().getIntExtra("i1", 0); 
		 countl = getIntent().getIntExtra("l1", 0);
		 counts = getIntent().getIntExtra("s1", 0); 
		try {
			g = (Gallery) findViewById(R.id.gallery);
			g.setAdapter(new ImageAdapter(this));
			g.setHorizontalScrollBarEnabled(true);
			Bundle bundle = getIntent().getExtras();
			galpos = bundle.getInt("GALPOS");
			countk1 = getIntent().getIntExtra("k", 0);
			
			g.setSelection(galpos);
			g.setAnimationDuration(motiongal);

		} catch (Exception e) {

		}
		g.setOnItemSelectedListener(this);

		ImageButton nextButton = (ImageButton) findViewById(R.id.nextimage);
		nextButton.setOnClickListener(nextButtonOnClick);
		
		ImageButton preButton = (ImageButton) findViewById(R.id.preimage);
		preButton.setOnClickListener(preButtonOnClick);
		 g.setOnItemClickListener(new OnItemClickListener() {
				public void onItemClick(AdapterView<?> parent, View v,
						int position, long id) {
					
					if (countk1 == 0) {
						
						if (position == 12) {
							count111 = 111;
							countin1++;
							Intent i = new Intent(HomE.this, HomeDEmo.class);
							i.putExtra("k3", count111);
							i.putExtra("aa1", countin1);
							startActivityForResult(i, 0);
						}
					}
					
					if (countk1 == 9) {
						if (position == 12) {
							count111i=9;
							countini++;
							Intent i = new Intent(HomE.this, DrawingScreEn1.class);
							i.putExtra("i", countini);
							i.putExtra("k3",count111i);
							startActivityForResult(i, 0);
						}
					}
					
					if (countk1 == 12) {
						if (position == 13) {
							count111l=13;
							countinl++;
							Intent i = new Intent(HomE.this, DrawingScreEn1.class);
							i.putExtra("k3",count111l);
							i.putExtra("l", countinl);
							startActivityForResult(i, 0);
						}
					}

					
					
					
					if (countk1 == 19) {
						
						if (position == 10) {
							count111s=19;
							countins++;
							Intent i = new Intent(HomE.this, DrawingScreEn1.class);
							i.putExtra("k3", count111s);
							i.putExtra("s", countins);
							
							startActivityForResult(i, 0);
						}
					}
					
					
					
					l1.setVisibility(View.VISIBLE);
					final Handler handler = new Handler();
					handler.postDelayed(new Runnable() {
						public void run() {
							// Do something after 100ms
							l1.setVisibility(View.INVISIBLE);
						}
					}, 1500);
				}
			});
	}
	public void onItemSelected(AdapterView<?> parent, View v, int position,
			long id) {

		nextbtn = position;

		if (countk1 == 0) {
			mSwitcher.setText(mTextNames[position]);
			if (position == 0) {
          intro1 = MediaPlayer.create(HomE.this, R.raw.abcsongnorwegianonlymusic);

					   intro1.start();
					   if(intro2!=null){
					         if(intro2.isPlaying())
					    intro2.stop();
					   }
					   }
			if (position == 1) {
				
				 if(intro1!=null){
			         if(intro1.isPlaying())
			    intro1.stop();
			   }
				
					   intro2 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_2);
				
					   intro2.start();
					   if(intro3!=null){
					         if(intro3.isPlaying())
					    intro3.stop();
					   }
					   }
			if (position == 2) {
				
				 if(intro2!=null){
			         if(intro2.isPlaying())
			    intro2.stop();
			   }
			
					   intro3 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_3);
			
					   intro3.start();
					   if(intro4!=null){
					         if(intro4.isPlaying())
					    intro4.stop();
					   }
			}
			if (position == 3) {
				
				 if(intro3!=null){
			         if(intro3.isPlaying())
			    intro3.stop();
			   }
			   intro4 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_4);
					   intro4.start();
					   if(intro5!=null){
					         if(intro5.isPlaying())
					    intro5.stop();
					   }
					   }
			if (position == 4) {
				 if(intro4!=null){
			         if(intro4.isPlaying())
			    intro4.stop();
			   }
			 intro5 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_5);
				   intro5.start();
					   if(intro6!=null){
					         if(intro6.isPlaying())
					    intro6.stop();
					   }
					   }
			if (position == 5) {
				 if(intro5!=null){
			         if(intro5.isPlaying())
			    intro5.stop();
			   }
			intro6 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_6);
					   intro6.start();
					   if(intro7!=null){
					         if(intro7.isPlaying())
					    intro7.stop();
					   }
			}
			if (position == 6) {
				
				 if(intro6!=null){
			         if(intro6.isPlaying())
			    intro6.stop();
			   }
			
					   intro7 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_7);
					  intro7.start();
					   if(intro8!=null){
					         if(intro8.isPlaying())
					    intro8.stop();
					   }
			}
			if (position == 7) {
				
				 if(intro7!=null){
			         if(intro7.isPlaying())
			    intro7.stop();
			   }
					   intro8 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_8);
				
					   intro8.start();
					   if(intro9!=null){
					         if(intro9.isPlaying())
					    intro9.stop();
					   }

			}
			if (position == 8) {
				
				 if(intro8!=null){
			         if(intro8.isPlaying())
			    intro8.stop();
			   }
				
					   intro9 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_9);
				
					   intro9.start();
					   if(intro10!=null){
					         if(intro10.isPlaying())
					    intro10.stop();
					   }
					   }
			if (position == 9) {
		
				 if(intro9!=null){
			         if(intro9.isPlaying())
			    intro9.stop();
			   }
					   intro10 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_10);
					   intro10.start();
					   if(intro11!=null){
					         if(intro11.isPlaying())
					    intro11.stop();
					   }
			}
			if (position == 10) {
				 if(intro10!=null){
			         if(intro10.isPlaying())
			    intro10.stop();
			   }
				 intro11 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_11);
			
					   intro11.start();
					   if(intro12!=null){
					         if(intro12.isPlaying())
					    intro12.stop();
					   }
				
				
			}
			if (position == 11) {

				 if(intro11!=null){
			         if(intro11.isPlaying())
			    intro11.stop();
			   }
				 intro12 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_12);
			       intro12.start();
					   if(intro13!=null){
					         if(intro13.isPlaying())
					    intro13.stop();
					   }
					  }
			if (position == 12) {
             if(intro12!=null){
			         if(intro12.isPlaying())
			    intro12.stop();
			   }
		  intro13 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_13);
			
					   intro13.start();
					   }
		}
		
		if(countk1==9)
		{
			mSwitcher.setText(mTextNames[position]);
			
	    }

	if(countk1==12)
		{
			mSwitcher7.setText(mTextNamesfourtin[position]);
			
		}
		
		if(countk1==19)
		{
			mSwitcher3.setText(mTextNamesleven[position]);
		}
	}
		
	public OnClickListener nextButtonOnClick = new OnClickListener() {
		public void onClick(View v) {
			if ( countk1 == 9 && countk1 == 13
					) {
				if (nextbtn < (mTextNames.length - 1)) {
					try {
						mSwitcher.setText(mTextNames[nextbtn + 1]);
						mSwitcher.startLayoutAnimation();
						mSwitcher.getDrawingTime();
						g.setSelection(nextbtn + 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher.setText(mTextNames[0]);
						mSwitcher.startLayoutAnimation();
						mSwitcher.getDrawingTime();
						g.setSelection(0);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}
				}
			}

			

			

			

			
			

			if (countk1 == 12
					) {
				if (nextbtn < (mTextNamesfourtin.length - 1)) {
					try {
						mSwitcher7.setText(mTextNamesfourtin[nextbtn + 1]);
						mSwitcher7.startLayoutAnimation();
						mSwitcher7.getDrawingTime();
						g.setSelection(nextbtn + 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher7.setText(mTextNamesfourtin[0]);
						mSwitcher7.startLayoutAnimation();
						mSwitcher7.getDrawingTime();
						g.setSelection(0);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}
				}
			}

			
			
			
			if (countk1 == 19 ) {
				if (nextbtn < (mTextNamesleven.length - 1)) {
					try {
						mSwitcher3.setText(mTextNamesleven[nextbtn + 1]);
						mSwitcher3.startLayoutAnimation();
						mSwitcher3.getDrawingTime();
						g.setSelection(nextbtn + 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher3.setText(mTextNamesleven[0]);
						mSwitcher3.startLayoutAnimation();
						mSwitcher3.getDrawingTime();
						g.setSelection(0);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}
				}
			}

			

					}
	};
		
	public OnClickListener preButtonOnClick = new OnClickListener() {
		public void onClick(View v) {
			if ( countk1 == 9 && countk1 == 13
					) {
				if (nextbtn > 0) {
					try {
						// mSwitcher.setText(mTextNames[nextbtn-1]);
						mSwitcher.startLayoutAnimation();
						mSwitcher.getDrawingTime();
						g.setSelection(nextbtn - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher.setText(mTextNames[mTextNames.length - 1]);
						mSwitcher.startLayoutAnimation();
						mSwitcher.getDrawingTime();
						g.setSelection(mTextNames.length - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}

				}
			}

			

			

			

			

			if ( countk1 == 12 
					) {
				if (nextbtn > 0) {
					try {
						// mSwitcher.setText(mTextNames[nextbtn-1]);
						mSwitcher7.startLayoutAnimation();
						mSwitcher7.getDrawingTime();
						g.setSelection(nextbtn - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher7
								.setText(mTextNamesfourtin[mTextNamesfourtin.length - 1]);
						mSwitcher7.startLayoutAnimation();
						mSwitcher7.getDrawingTime();
						g.setSelection(mTextNamesfourtin.length - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}

				}
			}

			

			

			

			if ( countk1 == 19 
					) {
				if (nextbtn > 0) {
					try {
						// mSwitcher.setText(mTextNames[nextbtn-1]);
						mSwitcher3.startLayoutAnimation();
						mSwitcher3.getDrawingTime();
						g.setSelection(nextbtn - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher3
								.setText(mTextNamesleven[mTextNamesleven.length - 1]);
						mSwitcher3.startLayoutAnimation();
						mSwitcher3.getDrawingTime();
						g.setSelection(mTextNamesleven.length - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}

				}
			}

			

			
			

		}
	};
		
	public void onNothingSelected(AdapterView<?> parent) {
	}

	public View makeView() {
		TextView i = new TextView(this);
		i.setTextSize(18);

		i.setGravity(1);
		return i;
	}

	public class ImageAdapter extends BaseAdapter {
		public ImageAdapter(Context c) {
			mContext = c;
		}

		public int getView() {
			// TODO Auto-generated method stub
			return 0;
		}

		public int getCount() {
			
			countk2 = getIntent().getIntExtra("k1", 0);
			return countk2;
		}

		public Object getItem(int position) {
			return position;
		}

		public long getItemId(int position) {
			return position;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			ImageView i = new ImageView(mContext);
			if (countk1 == 0) {
				mSwitcher.setVisibility(View.INVISIBLE);
				
				mSwitcher3.setVisibility(View.INVISIBLE);
			
				mSwitcher7.setVisibility(View.INVISIBLE);
				
				i.setImageResource(mPhotos.get(position));

			}
			

			if (countk1 == 9) {
				mSwitcher.setVisibility(View.INVISIBLE);
				
				mSwitcher3.setVisibility(View.INVISIBLE);
				
				mSwitcher7.setVisibility(View.INVISIBLE);
				
				i.setImageResource(mPhotosi.get(position));
			}
			
			if (countk1 == 12) {
				mSwitcher7.setVisibility(View.INVISIBLE);
				mSwitcher.setVisibility(View.INVISIBLE);
				
				mSwitcher3.setVisibility(View.INVISIBLE);
				
				i.setImageResource(mPhotosl.get(position));
			}
			
			
			
			
			
			
			if (countk1 == 19) {
				mSwitcher3.setVisibility(View.INVISIBLE);
				mSwitcher.setVisibility(View.INVISIBLE);
				
				mSwitcher7.setVisibility(View.INVISIBLE);
				

				i.setImageResource(mPhotosi.get(position));
			}
			
			
			i.setScaleType(ImageView.ScaleType.FIT_XY);
			i.setLayoutParams(new Gallery.LayoutParams(
					android.view.ViewGroup.LayoutParams.FILL_PARENT,
					android.view.ViewGroup.LayoutParams.FILL_PARENT));
                   return i;
		}

		private Context mContext;

	}
		
	private Integer[] mImageIds = { R.drawable.bokstavslottet01,
			R.drawable.bokstavslottet02, R.drawable.bokstavslottet03,
			R.drawable.bokstavslottet04, R.drawable.bokstavslottet05,
			R.drawable.bokstavslottet06, R.drawable.bokstavslottet07,
			R.drawable.bokstavslottet08, R.drawable.bokstavslottet09,
			R.drawable.bokstavslottet10, R.drawable.bokstavslottet11,
			R.drawable.bokstavslottet12, R.drawable.bokstavslottet13,

	};

	private Integer[] mImageIdsi = { R.drawable.i1, R.drawable.i2,
			R.drawable.i3, R.drawable.i4, R.drawable.i5, R.drawable.i6,
			R.drawable.i7, R.drawable.i8, R.drawable.i9, R.drawable.i10,
			R.drawable.i11, R.drawable.i12, R.drawable.i13 };
	private Integer[] mImageIdsl = { R.drawable.l1, R.drawable.l2,
			R.drawable.l3, R.drawable.l4, R.drawable.l5, R.drawable.l6,
			R.drawable.l7, R.drawable.l8, R.drawable.l9, R.drawable.l10,
			R.drawable.l11, R.drawable.l12, R.drawable.l13, R.drawable.l14

	};
	private static String[] mTextNamesleven = { "BOOKSTOVEN1", "BOOKSTOVEN2",
		"BOOKSTOVEN3", "BOOKSTOVEN4", "BOOKSTOVEN5", "BOOKSTOVEN6",
		"BOOKSTOVEN7", "BOOKSTOVEN8", "BOOKSTOVEN9", "BOOKSTOVEN10",
		"BOOKSTOVEN11" };
	private static String[] mTextNames = { "BOOKSTOVEN1", "BOOKSTOVEN2",
		"BOOKSTOVEN3", "BOOKSTOVEN4", "BOOKSTOVEN5", "BOOKSTOVEN6",
		"BOOKSTOVEN7", "BOOKSTOVEN8", "BOOKSTOVEN9", "BOOKSTOVEN10",
		"BOOKSTOVEN11", "BOOKSTOVEN12", "BOOKSTOVEN13" };
         private static String[] mTextNamesfourtin = { "BOOKSTOVEN1", "BOOKSTOVEN2",
		"BOOKSTOVEN3", "BOOKSTOVEN4", "BOOKSTOVEN5", "BOOKSTOVEN6",
		"BOOKSTOVEN7", "BOOKSTOVEN8", "BOOKSTOVEN9", "BOOKSTOVEN10",
		"BOOKSTOVEN11", "BOOKSTOVEN12", "BOOKSTOVEN13", "BOOKSTOVEN14" };
           private ArrayList<Integer> mPhotos = new ArrayList<Integer>(
		Arrays.asList(mImageIds));
            private ArrayList<Integer> mPhotosi = new ArrayList<Integer>(
		Arrays.asList(mImageIdsi));
            private ArrayList<Integer> mPhotosl = new ArrayList<Integer>(
		Arrays.asList(mImageIdsl));

       protected void onPause() {
                if (intro1 != null){
    	              intro1.stop();
                if (isFinishing()){
        	intro1.stop();
        	intro1.release();
             }
           }
    
    if (intro2 != null){
    	intro2.stop();
        if (isFinishing()){
        	intro2.stop();
        	intro2.release();
              }
        }
        if (intro3 != null){
        	intro3.stop();
            if (isFinishing()){
            	intro3.stop();
            	intro3.release();
            }
        }
        if (intro4 != null){
        	intro4.stop();
            if (isFinishing()){
            	intro4.stop();
            	intro4.release();
            }
        }
        if (intro5 != null){
        	intro5.stop();
            if (isFinishing()){
            	intro5.stop();
            	intro5.release();
            }
        }
        if (intro6 != null){
        	intro6.stop();
            if (isFinishing()){
            	intro6.stop();
            	intro6.release();
            }
        }
        if (intro7 != null){
        	intro7.stop();
            if (isFinishing()){
            	intro7.stop();
            	intro7.release();
            }
        }
        if (intro8 != null){
        	intro8.stop();
            if (isFinishing()){
            	intro8.stop();
            	intro8.release();
            }
        }
        if (intro9 != null){
        	intro9.stop();
            if (isFinishing()){
            	intro9.stop();
            	intro9.release();
            }
        }
        if (intro10 != null){
        	intro10.stop();
            if (isFinishing()){
            	intro10.stop();
            	intro10.release();
            }
        }
        if (intro11 != null){
        	intro11.stop();
            if (isFinishing()){
            	intro11.stop();
            	intro11.release();
            }
            
            if (intro12 != null){
            	intro12.stop();
                if (isFinishing()){
                	intro12.stop();
                	intro12.release();
                }
            }
                if (intro13 != null){
                	intro13.stop();
                    if (isFinishing()){
                    	intro13.stop();
                    	intro13.release();
                    }
          }
        }
         super.onPause();
         }
           }


 
how to play music in both farward and backward directions using mediaplyer in android
===

here i need to display some images in to gallery,at the same time when the image visable that time i need to display that image related sound also. i did that one using mediaplayer.its working fine in emulater.but in phones,tablets its not working scrolling images that time am getting error like fatelexception:main nullpointer exception,whats the prblm i dnt knw.please any one suggest me.....


           HomE .class:
           public class HomE extends Activity implements
           AdapterView.OnItemSelectedListener, ViewSwitcher.ViewFactory{
	private TextSwitcher mSwitcher;
	private TextSwitcher mSwitcher3;
	private TextSwitcher mSwitcher7;
	ImageButton home, sound;
	Gallery g;
	static int nextbtn = 0;
	static int prebtn = 0;
	ImageAdapter iadapter;
	int galpos;
	int countk1 = 0;
	int countk2;
	int countk3 = 0;
	int countk4 = 0;
	int count111 = 0;
	int count111i = 0;
	int count111l = 0;
	int count111s = 0;
	public static int countin,counti,countl,counts;
	public static int countin1=0;
	public static int countini=0;
	public static int countinl=0;
	public static int countins=0;
	public int ht;
	public int wt;
	MediaPlayer intro1, intro2, intro3, intro4, intro5, intro6, intro7, intro8,
	intro9, intro10, intro11, intro12, intro13;
	
	public static int motiongal = 3000;
	RelativeLayout l1, l2;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.home1);
        intro1 = MediaPlayer.create(this, R.raw.abcsongnorwegianonlymusic);
		intro2 = MediaPlayer.create(this, R.raw.bokstavslottet_2);
		intro3 = MediaPlayer.create(this, R.raw.bokstavslottet_3);
		intro4 = MediaPlayer.create(this, R.raw.bokstavslottet_4);
		intro5 = MediaPlayer.create(this, R.raw.bokstavslottet_5);
		intro6 = MediaPlayer.create(this, R.raw.bokstavslottet_6);
		intro7 = MediaPlayer.create(this, R.raw.bokstavslottet_7);
		intro8 = MediaPlayer.create(this, R.raw.bokstavslottet_8);
		intro9 = MediaPlayer.create(this, R.raw.bokstavslottet_9);
		intro10 = MediaPlayer.create(this, R.raw.bokstavslottet_10);
		intro11 = MediaPlayer.create(this, R.raw.bokstavslottet_11);
		intro12 = MediaPlayer.create(this, R.raw.bokstavslottet_12);
		intro13 = MediaPlayer.create(this, R.raw.bokstavslottet_13);
		
		
		
		home = (ImageButton) findViewById(R.id.homeimage);
		home.setOnTouchListener(new OnTouchListener() {

			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				Intent i = new Intent(HomE.this, HomeDEmo.class);
				startActivity(i);
				return false;
			}
		});
		sound = (ImageButton) findViewById(R.id.soundimage);
		sound.setOnTouchListener(new OnTouchListener() {

			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				return false;
			}
		});
		DisplayMetrics displaymetrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
		ht = displaymetrics.heightPixels;
		wt = displaymetrics.widthPixels;
		l1 = (RelativeLayout) findViewById(R.id.linear);
		l2 = (RelativeLayout) findViewById(R.id.linear1);
		l1.setVisibility(View.INVISIBLE);
		l2.setOnTouchListener(new OnTouchListener() {

			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				l1.setVisibility(View.VISIBLE);
				final Handler handler = new Handler();
				handler.postDelayed(new Runnable() {
					public void run() {
						// Do something after 100ms
						l1.setVisibility(View.INVISIBLE);
					}
				}, 1500);
				return false;
			}
		});
		mSwitcher = (TextSwitcher) findViewById(R.id.switcher);
		mSwitcher.setFactory(this);
		mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_in));
		mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_out));
		mSwitcher.startLayoutAnimation();
		mSwitcher3 = (TextSwitcher) findViewById(R.id.switcher3);
		mSwitcher3.setFactory(this);
		mSwitcher3.setInAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_in));
		mSwitcher3.setOutAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_out));
		mSwitcher3.startLayoutAnimation();
		
		mSwitcher7 = (TextSwitcher) findViewById(R.id.switcher7);
		mSwitcher7.setFactory(this);
		mSwitcher7.setInAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_in));
		mSwitcher7.setOutAnimation(AnimationUtils.loadAnimation(this,
				android.R.anim.fade_out));
		mSwitcher7.startLayoutAnimation();
		
		 countin = getIntent().getIntExtra("a1", 0); 
		 counti = getIntent().getIntExtra("i1", 0); 
		 countl = getIntent().getIntExtra("l1", 0);
		 counts = getIntent().getIntExtra("s1", 0); 
		try {
			g = (Gallery) findViewById(R.id.gallery);
			g.setAdapter(new ImageAdapter(this));
			g.setHorizontalScrollBarEnabled(true);
			Bundle bundle = getIntent().getExtras();
			galpos = bundle.getInt("GALPOS");
			countk1 = getIntent().getIntExtra("k", 0);
			
			g.setSelection(galpos);
			g.setAnimationDuration(motiongal);

		} catch (Exception e) {

		}
		g.setOnItemSelectedListener(this);

		ImageButton nextButton = (ImageButton) findViewById(R.id.nextimage);
		nextButton.setOnClickListener(nextButtonOnClick);
		
		ImageButton preButton = (ImageButton) findViewById(R.id.preimage);
		preButton.setOnClickListener(preButtonOnClick);
		 g.setOnItemClickListener(new OnItemClickListener() {
				public void onItemClick(AdapterView<?> parent, View v,
						int position, long id) {
					
					if (countk1 == 0) {
						
						if (position == 12) {
							count111 = 111;
							countin1++;
							Intent i = new Intent(HomE.this, HomeDEmo.class);
							i.putExtra("k3", count111);
							i.putExtra("aa1", countin1);
							startActivityForResult(i, 0);
						}
					}
					
					if (countk1 == 9) {
						if (position == 12) {
							count111i=9;
							countini++;
							Intent i = new Intent(HomE.this, DrawingScreEn1.class);
							i.putExtra("i", countini);
							i.putExtra("k3",count111i);
							startActivityForResult(i, 0);
						}
					}
					
					if (countk1 == 12) {
						if (position == 13) {
							count111l=13;
							countinl++;
							Intent i = new Intent(HomE.this, DrawingScreEn1.class);
							i.putExtra("k3",count111l);
							i.putExtra("l", countinl);
							startActivityForResult(i, 0);
						}
					}

					
					
					
					if (countk1 == 19) {
						
						if (position == 10) {
							count111s=19;
							countins++;
							Intent i = new Intent(HomE.this, DrawingScreEn1.class);
							i.putExtra("k3", count111s);
							i.putExtra("s", countins);
							
							startActivityForResult(i, 0);
						}
					}
					
					
					
					l1.setVisibility(View.VISIBLE);
					final Handler handler = new Handler();
					handler.postDelayed(new Runnable() {
						public void run() {
							// Do something after 100ms
							l1.setVisibility(View.INVISIBLE);
						}
					}, 1500);
				}
			});
	}
	public void onItemSelected(AdapterView<?> parent, View v, int position,
			long id) {

		nextbtn = position;

		if (countk1 == 0) {
			mSwitcher.setText(mTextNames[position]);
			if (position == 0) {
          intro1 = MediaPlayer.create(HomE.this, R.raw.abcsongnorwegianonlymusic);

					   intro1.start();
					   if(intro2!=null){
					         if(intro2.isPlaying())
					    intro2.stop();
					   }
					   }
			if (position == 1) {
				
				 if(intro1!=null){
			         if(intro1.isPlaying())
			    intro1.stop();
			   }
				
					   intro2 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_2);
				
					   intro2.start();
					   if(intro3!=null){
					         if(intro3.isPlaying())
					    intro3.stop();
					   }
					   }
			if (position == 2) {
				
				 if(intro2!=null){
			         if(intro2.isPlaying())
			    intro2.stop();
			   }
			
					   intro3 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_3);
			
					   intro3.start();
					   if(intro4!=null){
					         if(intro4.isPlaying())
					    intro4.stop();
					   }
			}
			if (position == 3) {
				
				 if(intro3!=null){
			         if(intro3.isPlaying())
			    intro3.stop();
			   }
			   intro4 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_4);
					   intro4.start();
					   if(intro5!=null){
					         if(intro5.isPlaying())
					    intro5.stop();
					   }
					   }
			if (position == 4) {
				 if(intro4!=null){
			         if(intro4.isPlaying())
			    intro4.stop();
			   }
			 intro5 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_5);
				   intro5.start();
					   if(intro6!=null){
					         if(intro6.isPlaying())
					    intro6.stop();
					   }
					   }
			if (position == 5) {
				 if(intro5!=null){
			         if(intro5.isPlaying())
			    intro5.stop();
			   }
			intro6 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_6);
					   intro6.start();
					   if(intro7!=null){
					         if(intro7.isPlaying())
					    intro7.stop();
					   }
			}
			if (position == 6) {
				
				 if(intro6!=null){
			         if(intro6.isPlaying())
			    intro6.stop();
			   }
			
					   intro7 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_7);
					  intro7.start();
					   if(intro8!=null){
					         if(intro8.isPlaying())
					    intro8.stop();
					   }
			}
			if (position == 7) {
				
				 if(intro7!=null){
			         if(intro7.isPlaying())
			    intro7.stop();
			   }
					   intro8 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_8);
				
					   intro8.start();
					   if(intro9!=null){
					         if(intro9.isPlaying())
					    intro9.stop();
					   }

			}
			if (position == 8) {
				
				 if(intro8!=null){
			         if(intro8.isPlaying())
			    intro8.stop();
			   }
				
					   intro9 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_9);
				
					   intro9.start();
					   if(intro10!=null){
					         if(intro10.isPlaying())
					    intro10.stop();
					   }
					   }
			if (position == 9) {
		
				 if(intro9!=null){
			         if(intro9.isPlaying())
			    intro9.stop();
			   }
					   intro10 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_10);
					   intro10.start();
					   if(intro11!=null){
					         if(intro11.isPlaying())
					    intro11.stop();
					   }
			}
			if (position == 10) {
				 if(intro10!=null){
			         if(intro10.isPlaying())
			    intro10.stop();
			   }
				 intro11 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_11);
			
					   intro11.start();
					   if(intro12!=null){
					         if(intro12.isPlaying())
					    intro12.stop();
					   }
				
				
			}
			if (position == 11) {

				 if(intro11!=null){
			         if(intro11.isPlaying())
			    intro11.stop();
			   }
				 intro12 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_12);
			       intro12.start();
					   if(intro13!=null){
					         if(intro13.isPlaying())
					    intro13.stop();
					   }
					  }
			if (position == 12) {
             if(intro12!=null){
			         if(intro12.isPlaying())
			    intro12.stop();
			   }
		  intro13 = MediaPlayer.create(HomE.this, R.raw.bokstavslottet_13);
			
					   intro13.start();
					   }
		}
		
		if(countk1==9)
		{
			mSwitcher.setText(mTextNames[position]);
			
	    }

	if(countk1==12)
		{
			mSwitcher7.setText(mTextNamesfourtin[position]);
			
		}
		
		if(countk1==19)
		{
			mSwitcher3.setText(mTextNamesleven[position]);
		}
	}
		
	public OnClickListener nextButtonOnClick = new OnClickListener() {
		public void onClick(View v) {
			if ( countk1 == 9 && countk1 == 13
					) {
				if (nextbtn < (mTextNames.length - 1)) {
					try {
						mSwitcher.setText(mTextNames[nextbtn + 1]);
						mSwitcher.startLayoutAnimation();
						mSwitcher.getDrawingTime();
						g.setSelection(nextbtn + 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher.setText(mTextNames[0]);
						mSwitcher.startLayoutAnimation();
						mSwitcher.getDrawingTime();
						g.setSelection(0);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}
				}
			}

			

			

			

			
			

			if (countk1 == 12
					) {
				if (nextbtn < (mTextNamesfourtin.length - 1)) {
					try {
						mSwitcher7.setText(mTextNamesfourtin[nextbtn + 1]);
						mSwitcher7.startLayoutAnimation();
						mSwitcher7.getDrawingTime();
						g.setSelection(nextbtn + 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher7.setText(mTextNamesfourtin[0]);
						mSwitcher7.startLayoutAnimation();
						mSwitcher7.getDrawingTime();
						g.setSelection(0);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}
				}
			}

			
			
			
			if (countk1 == 19 ) {
				if (nextbtn < (mTextNamesleven.length - 1)) {
					try {
						mSwitcher3.setText(mTextNamesleven[nextbtn + 1]);
						mSwitcher3.startLayoutAnimation();
						mSwitcher3.getDrawingTime();
						g.setSelection(nextbtn + 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher3.setText(mTextNamesleven[0]);
						mSwitcher3.startLayoutAnimation();
						mSwitcher3.getDrawingTime();
						g.setSelection(0);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}
				}
			}

			

					}
	};
		
	public OnClickListener preButtonOnClick = new OnClickListener() {
		public void onClick(View v) {
			if ( countk1 == 9 && countk1 == 13
					) {
				if (nextbtn > 0) {
					try {
						// mSwitcher.setText(mTextNames[nextbtn-1]);
						mSwitcher.startLayoutAnimation();
						mSwitcher.getDrawingTime();
						g.setSelection(nextbtn - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher.setText(mTextNames[mTextNames.length - 1]);
						mSwitcher.startLayoutAnimation();
						mSwitcher.getDrawingTime();
						g.setSelection(mTextNames.length - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}

				}
			}

			

			

			

			

			if ( countk1 == 12 
					) {
				if (nextbtn > 0) {
					try {
						// mSwitcher.setText(mTextNames[nextbtn-1]);
						mSwitcher7.startLayoutAnimation();
						mSwitcher7.getDrawingTime();
						g.setSelection(nextbtn - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher7
								.setText(mTextNamesfourtin[mTextNamesfourtin.length - 1]);
						mSwitcher7.startLayoutAnimation();
						mSwitcher7.getDrawingTime();
						g.setSelection(mTextNamesfourtin.length - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}

				}
			}

			

			

			

			if ( countk1 == 19 
					) {
				if (nextbtn > 0) {
					try {
						// mSwitcher.setText(mTextNames[nextbtn-1]);
						mSwitcher3.startLayoutAnimation();
						mSwitcher3.getDrawingTime();
						g.setSelection(nextbtn - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);

					} catch (Exception e) {
					}

				} else {
					try {
						mSwitcher3
								.setText(mTextNamesleven[mTextNamesleven.length - 1]);
						mSwitcher3.startLayoutAnimation();
						mSwitcher3.getDrawingTime();
						g.setSelection(mTextNamesleven.length - 1);
						Thread.sleep(300);
						g.scheduleLayoutAnimation();
						g.startLayoutAnimation();
						Thread.sleep(300);
						g.setAnimationDuration(motiongal);
					} catch (Exception e) {
					}

				}
			}

			

			
			

		}
	};
		
	public void onNothingSelected(AdapterView<?> parent) {
	}

	public View makeView() {
		TextView i = new TextView(this);
		i.setTextSize(18);

		i.setGravity(1);
		return i;
	}

	public class ImageAdapter extends BaseAdapter {
		public ImageAdapter(Context c) {
			mContext = c;
		}

		public int getView() {
			// TODO Auto-generated method stub
			return 0;
		}

		public int getCount() {
			
			countk2 = getIntent().getIntExtra("k1", 0);
			return countk2;
		}

		public Object getItem(int position) {
			return position;
		}

		public long getItemId(int position) {
			return position;
		}

		public View getView(int position, View convertView, ViewGroup parent) {
			ImageView i = new ImageView(mContext);
			if (countk1 == 0) {
				mSwitcher.setVisibility(View.INVISIBLE);
				
				mSwitcher3.setVisibility(View.INVISIBLE);
			
				mSwitcher7.setVisibility(View.INVISIBLE);
				
				i.setImageResource(mPhotos.get(position));

			}
			

			if (countk1 == 9) {
				mSwitcher.setVisibility(View.INVISIBLE);
				
				mSwitcher3.setVisibility(View.INVISIBLE);
				
				mSwitcher7.setVisibility(View.INVISIBLE);
				
				i.setImageResource(mPhotosi.get(position));
			}
			
			if (countk1 == 12) {
				mSwitcher7.setVisibility(View.INVISIBLE);
				mSwitcher.setVisibility(View.INVISIBLE);
				
				mSwitcher3.setVisibility(View.INVISIBLE);
				
				i.setImageResource(mPhotosl.get(position));
			}
			
			
			
			
			
			
			if (countk1 == 19) {
				mSwitcher3.setVisibility(View.INVISIBLE);
				mSwitcher.setVisibility(View.INVISIBLE);
				
				mSwitcher7.setVisibility(View.INVISIBLE);
				

				i.setImageResource(mPhotosi.get(position));
			}
			
			
			i.setScaleType(ImageView.ScaleType.FIT_XY);
			i.setLayoutParams(new Gallery.LayoutParams(
					android.view.ViewGroup.LayoutParams.FILL_PARENT,
					android.view.ViewGroup.LayoutParams.FILL_PARENT));
                   return i;
		}

		private Context mContext;

	}
		
	private Integer[] mImageIds = { R.drawable.bokstavslottet01,
			R.drawable.bokstavslottet02, R.drawable.bokstavslottet03,
			R.drawable.bokstavslottet04, R.drawable.bokstavslottet05,
			R.drawable.bokstavslottet06, R.drawable.bokstavslottet07,
			R.drawable.bokstavslottet08, R.drawable.bokstavslottet09,
			R.drawable.bokstavslottet10, R.drawable.bokstavslottet11,
			R.drawable.bokstavslottet12, R.drawable.bokstavslottet13,

	};

	private Integer[] mImageIdsi = { R.drawable.i1, R.drawable.i2,
			R.drawable.i3, R.drawable.i4, R.drawable.i5, R.drawable.i6,
			R.drawable.i7, R.drawable.i8, R.drawable.i9, R.drawable.i10,
			R.drawable.i11, R.drawable.i12, R.drawable.i13 };
	private Integer[] mImageIdsl = { R.drawable.l1, R.drawable.l2,
			R.drawable.l3, R.drawable.l4, R.drawable.l5, R.drawable.l6,
			R.drawable.l7, R.drawable.l8, R.drawable.l9, R.drawable.l10,
			R.drawable.l11, R.drawable.l12, R.drawable.l13, R.drawable.l14

	};
	private static String[] mTextNamesleven = { "BOOKSTOVEN1", "BOOKSTOVEN2",
		"BOOKSTOVEN3", "BOOKSTOVEN4", "BOOKSTOVEN5", "BOOKSTOVEN6",
		"BOOKSTOVEN7", "BOOKSTOVEN8", "BOOKSTOVEN9", "BOOKSTOVEN10",
		"BOOKSTOVEN11" };
	private static String[] mTextNames = { "BOOKSTOVEN1", "BOOKSTOVEN2",
		"BOOKSTOVEN3", "BOOKSTOVEN4", "BOOKSTOVEN5", "BOOKSTOVEN6",
		"BOOKSTOVEN7", "BOOKSTOVEN8", "BOOKSTOVEN9", "BOOKSTOVEN10",
		"BOOKSTOVEN11", "BOOKSTOVEN12", "BOOKSTOVEN13" };
         private static String[] mTextNamesfourtin = { "BOOKSTOVEN1", "BOOKSTOVEN2",
		"BOOKSTOVEN3", "BOOKSTOVEN4", "BOOKSTOVEN5", "BOOKSTOVEN6",
		"BOOKSTOVEN7", "BOOKSTOVEN8", "BOOKSTOVEN9", "BOOKSTOVEN10",
		"BOOKSTOVEN11", "BOOKSTOVEN12", "BOOKSTOVEN13", "BOOKSTOVEN14" };
           private ArrayList<Integer> mPhotos = new ArrayList<Integer>(
		Arrays.asList(mImageIds));
            private ArrayList<Integer> mPhotosi = new ArrayList<Integer>(
		Arrays.asList(mImageIdsi));
            private ArrayList<Integer> mPhotosl = new ArrayList<Integer>(
		Arrays.asList(mImageIdsl));

       protected void onPause() {
                if (intro1 != null){
    	              intro1.stop();
                if (isFinishing()){
        	intro1.stop();
        	intro1.release();
             }
           }
    
    if (intro2 != null){
    	intro2.stop();
        if (isFinishing()){
        	intro2.stop();
        	intro2.release();
              }
        }
        if (intro3 != null){
        	intro3.stop();
            if (isFinishing()){
            	intro3.stop();
            	intro3.release();
            }
        }
        if (intro4 != null){
        	intro4.stop();
            if (isFinishing()){
            	intro4.stop();
            	intro4.release();
            }
        }
        if (intro5 != null){
        	intro5.stop();
            if (isFinishing()){
            	intro5.stop();
            	intro5.release();
            }
        }
        if (intro6 != null){
        	intro6.stop();
            if (isFinishing()){
            	intro6.stop();
            	intro6.release();
            }
        }
        if (intro7 != null){
        	intro7.stop();
            if (isFinishing()){
            	intro7.stop();
            	intro7.release();
            }
        }
        if (intro8 != null){
        	intro8.stop();
            if (isFinishing()){
            	intro8.stop();
            	intro8.release();
            }
        }
        if (intro9 != null){
        	intro9.stop();
            if (isFinishing()){
            	intro9.stop();
            	intro9.release();
            }
        }
        if (intro10 != null){
        	intro10.stop();
            if (isFinishing()){
            	intro10.stop();
            	intro10.release();
            }
        }
        if (intro11 != null){
        	intro11.stop();
            if (isFinishing()){
            	intro11.stop();
            	intro11.release();
            }
            
            if (intro12 != null){
            	intro12.stop();
                if (isFinishing()){
                	intro12.stop();
                	intro12.release();
                }
            }
                if (intro13 != null){
                	intro13.stop();
                    if (isFinishing()){
                    	intro13.stop();
                    	intro13.release();
                    }
          }
        }
         super.onPause();
         }
           }


 