0

I am building an application that has 2 classes - Buttons_Class - Display_Class I want to keep them as separate classes. When the user clicks on a button the OnClick routine in the Buttons_Class creates an intent and a bundle and starts the Display_Class activity. This is working fine. The Display_Class gets the information and displays it in a TextView.

What needs to happen next? If the user clicks on a second button, does the Display_Activity need to be recreated? Does a new intend need to be created? How does the information go from one activity to the next every time the user clicks on a button. Any examples will be greatly appreciated.

4

1 回答 1

0

If the user clicks on a second button, does the Display_Activity need to be recreated?

When you call startActivity(), by default, it creates a new instance of the activity. You can control that with flags on the Intent if you want, such as FLAG_ACTIVITY_REORDER_TO_FRONT.

Does a new intend need to be created?

If you are starting a different activity, yes. If you are starting another copy of Display_Activity, perhaps not.

于 2011-03-28T23:54:35.543 回答