Im new to Android.
What i need is?..
Can i get two string values in a single hashmap, its possible.
I have two hashmaps,these two hashmap values should i get in another hashmap. How to implement this? Any help.. Thanks in advance..
String question = c.getString(TAG_QUES); System.out.println("Checking ::"+question); HashMap<String, String> map = new HashMap<String, String>(); map.put(TAG_QUES,question); System.out.println("questionMap:"+map); ques1.add(question);
String answer = c.getString(TAG_ANSW);
System.out.println("Checking ::"+answer);
HashMap<String, String> map1 = new HashMap<String, String>();
map1.put(TAG_ANSW, answer);
System.out.println("AnswerMap:"+map1);
answ1.add(answer);
I want to get these two hashmap values(TAG_QUESID and TAG_ANSW) in a single hashmap in a single key eg): if i have map3 and i print map3 i should print these two values..
How to do this? because based upon the questionid i should get the answers,i want to increment the questionid for next question. plz help me..
Indeed, this is a java question. There are many ways you can do this.
HashMap<String, String[]> map = new HashMap<String, String[]>();HashMap<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();Create a class or enum(preferred) for example TAG, which has two string fields, then
Map<String, TAG> map = new HashMap<String, TAG>();Since your updated question is a little bit unclear, I tried to answer this based on my own understanding. I think what you want to do is continously getting questions and their answers.
So may be you can try another approach: