Differences between up and back button in Android
I think you should modify your Manifest.xml
file and tell your Manifest file
the relationships between your activities. This should solve the problem.
For Example:
<application ... >
...
<!-- The main/home activity (has no parent activity) -->
<activity
android:name="com.example.myfirstapp.MainActivity" ...>
...
</activity>
<!-- A child of the main activity -->
<activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="@string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstapp.MainActivity" />
</activity>
You can also review this document.
EDIT:
You can also use Data Persistence, if you are receiving empty Intents in certain Activities.
for Data persistence in Android, you can use Shared Preferences, SQLite Database, Serialization, etc
As you are learning Android Development, you can simply put the trackArray
values in Shared Preferences of your application while starting List Activity from Main Activity and Load the data of trackArray
from Shared Preferences in List Activity in onResume
and populate it in onCreate
.
This way, your Action bar's up button will not make the data of ListView Activity disappear.
P.S: Shared pref's actual purpose is to store values that are less in size and are changed occasionally such as Setting's data of a specific Application. Therefore, please don't misuse it.