Switching over to next Screen from the main Activity by clicking on the Button

David Brown picture David Brown · Nov 18, 2010 · Viewed 14.4k times · Source

I am working on an application where I need to go to the next Screen form the Main Actvity when I Click on the Image Button of the Main Activity Screen.

I had searched a bit on Net regarding this and found something like the OnClickListener method. I am still stuck for what exactly I want to do actually.

Can anyone please tell me how to do the same.

Thanks, david

Answer

viv picture viv · Nov 18, 2010
yourButton.setOnClickListener(){    
    public void onCLick(View v){
      Intent i=new Intent(
             YouCurrentClass.this,
             NameOfJaveInWhichYouWantToMove.class);
      startActivity(i);
    }
};