Hi i have an arraylist that i want to access from another class, i'm new to android please try to explain in a simple way
//Adding item to ArrayList
Cursor cursor2=shoppingListDB.rawQuery("SELECT * FROM " + selected_spinner + ";", null);
if (cursor2.moveToFirst()){
list.clear();
do{
String itemName = cursor2.getString(cursor2.getColumnIndex("ITEM_NAME"));
String shopList = cursor2.getString(cursor2.getColumnIndex("SHOP_LIST"));
String numbItems = cursor2.getString(cursor2.getColumnIndex("NUMB_ITEMS"));
//Adding Items to the arraylist
list.add(numbItems + " x"+ " " +itemName + " " + "@"+shopList);
}
while (cursor2.moveToNext());
//====CODE FOR SHOWING DATA AS A SIMPLE LIST ITEM=========================================
view_list = (ListView)findViewById(R.id.listItems);
ArrayAdapter <String> adapter=new ArrayAdapter<String>(CreateList.this,android.R.layout.simple_list_item_1,list);
view_list.setAdapter(adapter);
}
else{
Toast.makeText(getApplicationContext(), "DATA NOT AVAILABLE", 3000).show();
}
cursor2.close();