title: how to access child class variable in parent class?
body: <p>Hi everybody,
               Am beginner to android, i have one doubt in accessing variables..  In my app, 
  I have  to show the previous and next images from drawable.. it was done already.. 
  But my problem was, it should play the video in parent class according to the images in child class, so  that i need to access the child class variable in parent class.... Whether it is possible or not ??   Any idea.. Thanks!</p>
  
  <pre><code>// Main class
  public class TransitionViewExampleActivity extends Activity implements
      OnClickListener {
  
      ImageButton play;
      private final int ANIMATION_DURATION_MSEC = 1000;
  
      private Button _leftButton;
      private Button _rightButton;
      private TransitionView _mainView;
  
      VideoView videoView;
      Context context;
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
      setContentView(R.layout.main);
  
      play = (ImageButton) findViewById(R.id.ib_play_btn);
      play.setOnClickListener(this);
  
      _leftButton = (Button) findViewById(R.id.buttonLeft);
      _rightButton = (Button) findViewById(R.id.buttonRight);
      _mainView = (TransitionView) findViewById(R.id.mainView);
  
  
      _mainView.setVisibility(View.VISIBLE);
  
  }
  
  
      public void onClick(View v) {
  
   videoView = (VideoView) findViewById(R.id.videoView1);
  
  
      switch (v.getId()) {
      // TODO Auto-generated method stub
  
      case R.id.ib_play_btn:
  
  
  
      //  Toast.makeText(this, "Please Login to view video",Toast.LENGTH_SHORT).show();   
  
          play.setVisibility(View.INVISIBLE);
          _mainView.setVisibility(View.INVISIBLE);
          _leftButton.setVisibility(View.INVISIBLE);
          _rightButton.setVisibility(View.INVISIBLE);
  
  
  
  
          MediaController mediaController = new MediaController(this);
          mediaController.setAnchorView(videoView);
          videoView.setMediaController(mediaController);                    
        String path = "android.resource://" + getPackageName() + "/" + R.raw.test1;
        videoView.setVideoURI(Uri.parse(path));
        videoView.start();
  
          break;
  
  
      }
  
      if (v == _leftButton) {
  
          // fadeIn.setDuration(ANIMATION_DURATION_MSEC);
  
          this.overridePendingTransition(R.anim.slide_in_left,
                  R.anim.slide_out_right);
  
          _mainView.changePage(false);
      } else if (v == _rightButton) {
          this.overridePendingTransition(R.anim.slide_in_right,
                  R.anim.slide_out_left);
  
          _mainView.changePage(true);
  
      }
  
     }
  
   }
  
  
  
  
  // Sub class (Child class)
  
  
      class TransitionView extends RelativeLayout {
  
  
  
     /** One of the two in-memory art images */
     private ImageView _artView1;
     /** The other of the two in-memory art images */
     private ImageView _artView2;
    /** Length of art view transition animation, in milliseconds */
     private final int ANIMATION_DURATION_MSEC = 1000;
    /** The underlying ImageSwitcher that performs transitions */
     private ImageSwitcher _imageSwitcher;
    /** Index into _imageIds array */
    private int _currentImage = 0;
    /** All available art image resource ids */
  
  private final Integer[] _imageIds = { R.drawable.thuppaki,
          R.drawable.gouravam, R.drawable.splash2, R.drawable.pic04 };
  
  Animation fadeIn, fadeOut;
  
  Context context;
  
  
  public TransitionView(Context context) {
      super(context);
      customInit(context);
  }
  
  
  private void customInit(Context context) {
  
      _imageSwitcher = new ImageSwitcher(context);
  
  
      _imageSwitcher.setInAnimation(fadeIn);
      _imageSwitcher.setOutAnimation(fadeOut);
  
      _artView1 = new ImageView(context);
      _artView1.setImageResource(_imageIds[_currentImage]);
  
      _artView2 = new ImageView(context);
      _artView2.setImageResource(_imageIds[_currentImage + 1]);
  
      LayoutParams fullScreenLayout = new LayoutParams(
              LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
      _imageSwitcher.addView(_artView1, 0, fullScreenLayout);
      _imageSwitcher.addView(_artView2, 1, fullScreenLayout);
      _imageSwitcher.setDisplayedChild(0);
      addView(_imageSwitcher, fullScreenLayout);
  }
  
  /** @see android.view.View#View(Context, AttributeSet) */
  public TransitionView(Context context, AttributeSet attrs) {
      super(context, attrs);
      customInit(context);
  }
  
  /** @see android.view.View#View(Context, AttributeSet, int) */
  public TransitionView(Context context, AttributeSet attrs, int defStyle) {
      super(context, attrs, defStyle);
      customInit(context);
  }
  
  
  public void changePage(boolean pageRight) {
      _currentImage = (pageRight) ? (_currentImage + 1) : (_currentImage - 1);
      if (_currentImage &lt; 0) {
  
          _currentImage = _imageIds.length - 1;
      } else if (_currentImage &gt;= _imageIds.length) {
          _currentImage = 0;
  
  
      }
  
      if (_imageSwitcher.getCurrentView() == _artView1) {
  
          _artView2.setImageResource(_imageIds[_currentImage]);
          _imageSwitcher.showNext();
      } else {
          _artView1.setImageResource(_imageIds[_currentImage]);
          _imageSwitcher.showPrevious();
      }
  }   
  
  }
  </code></pre>
  
  <p>Finally, I want to acceess the child class variables <strong>_imageIds</strong> and 
  <strong>_currentImage</strong> in parent class........Any idea ???</p>