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.

  • possible dublicate - http://stackoverflow.com/questions/2091465/how-to-pass-data-between-activities-in-android – itsaboutcode Mar 28 '11 at 22:46
  • 2
    and a hint: CamelCase should be used in Java, for variable names and also for classnames. underscore is valid, but not really used in any of the recommended coding styles from sun and/or google – WarrenFaith Mar 28 '11 at 22:47

1 Answers1

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491