[android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Graham Bright
Hi, I have a hashmap with key, value pairs example :- (msisdn,value) 43664xxx,2 43665xxx,3 now I want to display this information in a ListView but I don't know how to feed the data to an ArrayAdapter. HERE IS MY ADAPTER, note I want to replace myList with data from the Hashmap a

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Justin Anderson
Keep in mind that HashMap does not have an order... ArrayAdapter does everything based on a position value, which indicates an ordered collection of some sort. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, Apr 3, 2012 at 1:16 PM, Graham Bright

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Graham Bright
Thanks Justin, Order is not important, as my end goal is to present to the user a simple list of values + keys. When the user longclicks on an item it will be deleted from the hash. What would you suggest? graham On Tue, Apr 3, 2012 at 9:24 PM, Justin Anderson magouyaw...@gmail.comwrote:

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Justin Anderson
When you need to update the adapter, iterate over your hash map and insert all the data into a list. Maybe do something like this: 1) Create a DataPairs class: public class DataPairs { public String _key; public String _value; public DataPairs(String key, String val) {

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Graham Bright
Thanks Justin, I'll give that a go. graham On Tue, Apr 3, 2012 at 9:56 PM, Justin Anderson magouyaw...@gmail.comwrote: When you need to update the adapter, iterate over your hash map and insert all the data into a list. Maybe do something like this: 1) Create a DataPairs class: public

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Graham Bright
One more question when I declare a test HashMap it seems only to work as static private static final MapInteger, String myHashMap = new HashMapInteger, String(); static { myHashMap.put(1, one); myHashMap.put(2, two); } and I am unable to access the HashMap outside of the brackets. So new

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Justin Anderson
One more question when I declare a test HashMap it seems only to work as static private static final MapInteger, String myHashMap = new HashMapInteger, String(); static { myHashMap.put(1, one); myHashMap.put(2, two); } and I am unable to access the HashMap outside of the brackets. So new

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Justin Anderson
Can you provide some actual snippets of code... like more than just how you are declaring your HashMap? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, Apr 3, 2012 at 2:42 PM, Justin Anderson magouyaw...@gmail.comwrote: One more question when I

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Graham Bright
private static final MapInteger, String myHashMap = new HashMapInteger, String(); static { myHashMap.put(1, one); myHashMap.put(2, two); } Sorry I found the problem thanks graham On Tue, Apr 3, 2012 at 10:42 PM, Justin Anderson magouyaw...@gmail.comwrote: Can you provide

Re: [android-developers] CAN SOMEONE PLEASE HELP with hashmaps thank you

2012-04-03 Thread Justin Anderson
Why are you making it static? Just do this: public class MyClass { private MapInteger, String myHashMap; public MyClass() { myHashMap = new HashMapInteger, String(); myHashMap.put(1, one); myHashMap.put(2, two); } } Thanks, Justin Anderson