Yes its working for me: Thanks .
The code is
The more general problem you are encountering is how to save state across
several Activities and all parts of your application. A static variable is
a common Java way of achieving this.
public class ImageCursorAdapter extends SimpleCursorAdapter
{
public static SortedMap<String, String> phoneNumberMap = new TreeMap<String,
String>();
public static SortedMap<String, String> getPhoneNumberMap() {
return phoneNumberMap;
}
public static void setPhoneNumberMap(SortedMap<String, String>
phoneNumberMap) {
ImageCursorAdapter.phoneNumberMap = phoneNumberMap;
}
}
public class class ListContacts extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
System.out.println("Map size: : " +
ImageCursorAdapter.getPhoneNumberMap().size());
Set s = ImageCursorAdapter.getPhoneNumberMap().entrySet();
Iterator it = s.iterator();
while (it.hasNext()) {
Map.Entry m = (Map.Entry) it.next();
String key = (String) m.getKey();
String value = (String) m.getValue();
System.out.println("loadContactDetails Map : Value : Names : " +
value);
System.out.println("loadContactDetails Map : Key : Names : " + key);
}
}
}
REFER:
http://stackoverflow.com/questions/708012/android-how-to-declare-global-variables
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en