Reputation: 4823
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
Upvotes: 3
Views: 15863
Reputation: 11
Try this ...it will help you for sure
public class your_file_name extends Activity implements OnClickListener {
public ImageButton any_name;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
any_name = (ImageButton) findViewById(R.id.given id<check in your layout for it> );
any_name. setOnClickListener(){
public void onCLick(View v){
Intent myintent=new Intent(your_file_name.this, next_desired_class.class);
startActivityforresult(myintent,100);
}
};
Upvotes: 0
Reputation: 1
or other method of loading all pages at start and after the application simply just manage the visibility layouts. Try to research the ViewFlipper is interresting.
Upvotes: 0
Reputation: 6177
yourButton.setOnClickListener(){
public void onCLick(View v){
Intent i=new Intent(
YouCurrentClass.this,
NameOfJaveInWhichYouWantToMove.class);
startActivity(i);
}
};
Upvotes: 7
Reputation: 19344
if you have your view as xml layout in your project then what you want to do is
onTouch or onClick or whatever triggers your change view
setContentView(R.layout.layoutYouWantToDisplay);
Upvotes: 1