I have the map declared before onCreate
public ArrayList<Map<String,String>> c_tmp= new ArrayList<Map<String,String>>();
public Map<String,String> mapa;
and then in a function that is triggered by textwatcher, I want to fill the map but there seems to be an error
String numberz = phones1.getString(phones1.getColumnIndex(Phone.NUMBER));
if(numberz.contains("07"))
{ name1 = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
if(name1!=null)
{
nnn=name1;//+"\n"+numberz;
mapa.put(numberz,nnn);
c_tmp.add(mapa);
}
}
The line :
will throw an error. mapa is not instanciated in your code.
replace the second line by :