Now I Will Teach You How To Switch Between Activity(Screens) On An Android Project..
Its Simple As ABC.
1. Go to the src folder in your application and expand it.
2. You will find your package which you has created before. Now Expand That.
3. Now open the java file relevant to your activity.
4. For example if you want to go to a new activity on a button click then.
Make your button click event and then paste this code inside your button click function
* change current_activity_class_name.this to your current class.this
startActivity(new Intent(current_activity_class_name.this,next_activity_class_name.class));
* change next_activity_class_name to your next_class.class
* Use this if you want the current activity to be destroyed
finish();
* You Will Have To Import Some Classes When You Put This Code.
* Press ctrl+shift+o then it will automatically fix your imports
No comments:
Post a Comment