My first suggestion would be why cant the second activity simply query the database itself?
Other then that if you must I'd suggest getting the results from the ArrayAdapter
into an ArrayList
and using Bundle.putParcelableArrayList when calling the second activity.
See here or this for passing Bundles to Activities and reading their values back again, but essentially you would do something like this when calling the second activity:
Intent intent = new Intent(this, SecondActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("LIST_OF_CUSTOMERS", arrayListOfCustomers);
intent.putExtras(bundle);
startActivity(intent);
And inside the second Activity:
ArrayList<..> customers = getActivity().getIntent().getParcelableArrayListExtra<..>("LIST_OF_CUSTOMERS");
if (customers != null) {
// do something with the data
}
The only thing to remember is that whatever type your list is of i.e. ArrayList<Customer>
, Customer
class needs to implement the Parcelable
interface. See here or here for more.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…