Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9199357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:31:05+00:00 2026-06-17T22:31:05+00:00

Im new to Android. What i need is?.. Can i get two string values

  • 0

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..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:31:06+00:00Added an answer on June 17, 2026 at 10:31 pm

    Indeed, this is a java question. There are many ways you can do this.

    1. HashMap<String, String[]> map = new HashMap<String, String[]>();

    2. HashMap<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();

    3. 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:

    class Question{
        String questionText;
        String answer;
        ...
    }
    
    //map from questionID to a question
    Map<String, Question> questionMap = new HashMap<String, Question>();
    //TODO: fill up the map with existing questions.
    Question question = questionMap.get(questionID);
    System.out.println("Question:" + question.questionText + " Answer:" + question.answer);
    //same for another question
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to android and need help on this. I have two views
Im new to android.. I have three ArrayList hashmap..one is for questions, second is
I need to get latitude and longitude to my android, it got many values
I have this string containing a date I need to parse to get a
I'm quite new at android and SQL. I'm making an app, which can get
I am new to Android i need to implement buttons having the size of
Hello i am new in android and i really need help with something. I
I am new in Android. Now I need EditText which should be no more
I am new to android application development. I need a solution for setting random
I'm new To android ecosystem. Do I really need to install all the SDK

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.