tags:

views:

44

answers:

1

In my application, I currently have several activities that consist of a TextView and a scrollbar. The only difference between them is the string that the TextView displays. Is there a way to consolidate all of these into one single activity, and depending on how/where the activity is started from, changes the TextView? Perhaps send the name of the string as an argument to startActivity, or something along those lines?

+2  A: 

When you start your Activity with an Intent you can pass values to it with the Bundle object.

This can be done quite easily with this method call:

http://developer.android.com/reference/android/content/Intent.html#putExtra(java.lang.String, java.lang.String)

From the new Activity (the one started with the call to startActivity()) you can get this value by calling getIntent().getExtras().getXXX(YOUR KEY)

nicholas.hauschild
Perfect! Exactly what I was searching for... thanks
dfetter88