Faiz Mir Faiz Mir - 5 months ago 32
Android Question

How to Retrive Data from ArrayAdapter

I want to retrive data from Array adapter and store it on database
like if a details of a scaned bluetooth is stored in a arrayadapter and i want to get that data and store it on my database..
any help would be apreciated


you can add to your Adapter Class it will return all adapter items in a List, you can then do whatever you want with it

public class MyAdapter extends ArrayAdapter<YourAdapterObject> {

    //Adapter implementation

   public List<YourAdapterObject> getAllItems(){
        ArrayList<YourAdapterObject> result = new ArrayList<>()
        for (int i = 0; i < getCount(); i++) {
        return result;