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
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
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:
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)
{
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
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
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
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
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
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
10 matches
Mail list logo