Can we access Java.util Map of a class in another class
<p>I am using a SortedMap in a calss that extends SimpleCursoradapter. can i acess that map from another class that extends ListActivity.</p>

<p>The code im using is given below.</p>

<pre><code>public

class ListContacts extends ListActivity { 
ListAdapter 

lAdapter; 
@Override


public void onCreate(Bundle savedInstanceState) { 

super.onCreate(savedInstanceState); 
setContentView(R.layout.

activitylist); 

// 

/** 
* 

* Use the ContentResolver instance to query the database and return a

* Cursor with the contacts list. The query is performed against the URI

* stored in ContactsContract.Contacts.CONTENT_URI.

*/


Cursor cursor = getContentResolver().query(

ContactsContract.Contacts.

CONTENT_URI, null, 
ContactsContract.Contacts.

HAS_PHONE_NUMBER + " = 1", null,null); 
startManagingCursor(cursor);



// start mappings 

String[]  columns = new String[] { ContactsContract.Contacts.DISPLAY_NAME }; 

int[] names  = new int[] { R.id.contact_name }; 


lAdapter = new ImageCursorAdapter(this, R.layout.main, cursor, columns,names); 



@Override 

protected void onListItemClick(ListView l, View v, int position, long id) { 

super.onListItemClick(l, v, position, id); 
}





} //  end of class ListContacts 



public

class ImageCursorAdapter extends SimpleCursorAdapter { 


private Cursor c; 

private Context context; 

SortedMap&lt;String, String&gt; 

phoneNumberMap = new TreeMap&lt;String, String&gt;(); 


public SortedMap&lt;String, String&gt; getPhoneNumberMap() { 

return phoneNumberMap; 
}



public void setPhoneNumberMap(SortedMap&lt;String, String&gt; phoneNumberMap) { 

this.phoneNumberMap = phoneNumberMap; 
}








public ImageCursorAdapter(Context context, int layout, Cursor c, 
String[] from, 

int[] to) { 

super(context, layout, c, from, to); 


this.c = c; 

this.context = context; 
}







public View getView(int pos, View inView, ViewGroup parent) { 
phoneNumberMap

.put("1", "fasfa"); 
  phoneNumberMap.put("2", "fasfa1"); 

phoneNumberMap.put("3", "fasfa2"); 

phoneNumberMap.put("4", "fasfa3"); 

phoneNumberMap.put("5", "fasfa4");

phoneNumberMap.put("6", "fasfa5");

System.

out.println(" Map : size: " + phoneNumberMap.size()); 

} 
}// end of  class ImageCursorAdapter
</code></pre>

<p>How can i access phoneNumberMap in the onListItemClick () method of Listcontacts class.</p>
