Is it possible in the main Activity in a separate thread, loading a ArrayList (reading records from a database) and use that ArrayList loaded in a secondary Activity?
4 Answers
You can try new Intent().putStringArrayListExtra(String name, ArrayList<String> value) to pass String Arraylist from one Activity to another Activity For Refrence See
pass arraylist from one activity to other
Comments
If you just want to load the data in the Activity and not show views in both Activities then you should use the class "Service" which is an activity running in the background.
2 Comments
Waynn Lue
How exactly would you use the class Service?
Tobias
I would create an interface for the communication between the Service and the Activity that have a function for initiating the fetch and one for registering a handle/callback so that the result can be "returned" to the Activity. developer.android.com/reference/android/app/…