public List<Contact> getContacts()
{
SQLiteDatabase db;
String cmd;
List<Contact> name = new ArrayList<Contact>();
db = myDb.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM contact;" , null);
while(cursor.moveToNext())
{
int contactID = Integer.parseInt(cursor.getString(0));
String familyName = cursor.getString(1);
String firstName = cursor.getString(2);
int houseNumber = Integer.parseInt(cursor.getString(3));
String street = cursor.getString(4);
String town = cursor.getString(5);
String country = cursor.getString(6);
String postcode = cursor.getString(7);
int telephoneNumber = Integer.parseInt(cursor.getString(8));
Contact contact = new Contact(contactID,familyName,firstName,houseNumber,street,town,country,postcode,telephoneNumber);
}
Intent intent = new Intent(Database.this,MainActivity.class);
intent.putStringArrayListExtra("contacts", name);
startActivity(intent);
return name;
}
The method putStringArrayListExtra(String, ArrayList<String>)
in the type Intent is not applicable for the arguments (String, List<Contact>)
in order to use putStringArrayListExtra();
method, i need to convert List<contact>
name to List name, How do i convert it?
thank you