2012-11-19 2 views
1

HashMap을 포함하는 ArrayListArrayAdapter으로 설정할 수 있습니까?ArrayAdapter의 ArrayList <HashMap <String, String >>

내가

ArrayAdapter<ArrayList<HashMap<String, String>>> ad= 
new ArrayAdapter<ArrayList<HashMap<String,String>>>(this, android.R.layout.simple_list_item_1,items); 

를 사용하고 있지만 나를 위해 작동하기 때문에이 나에게 당신이 코드 아래 사용할 수 있습니다 @nikhil

The constructor ArrayAdapter<ArrayList<HashMap<String,String>>>(searchname, int, ArrayList<HashMap<String,String>>) is undefined. 
+1

대신 'SimpleAdapter'를 사용할 수 있습니다. – fiddler

답변

8

말하는 오류를 제공합니다.

ArrayList<HashMap<String, String>> inviteList = new ArrayList<HashMap<String, String>>(); 
    for(int i=0;i < inviteListRespone.size();i++) 
    { 
     map = new HashMap<String, String>(); 
     map.put("id",String.valueOf(i)); 
     map.put("emailID", inviteListRespone.get(i).getEmail()); 
     inviteList.add(map); 
    } 
    adapter = new SimpleAdapter(context, inviteList, R.layout.invite_list_view, 
      new String[] { "emailID" },new int[]{R.id.inviteTextView}); 

    listBoth.setAdapter(adapter); 
관련 문제