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

  • SEARCH
  • Home
  • 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 8404165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:31:47+00:00 2026-06-09T22:31:47+00:00

I am trying to retrieve values from a json api and displaying then in

  • 0

I am trying to retrieve values from a json api and displaying then in a listView. The listView contains 3 elements and I am also implementing onItemClickListner() and when an Item is clicked it will display a detailed view related to that item. I am using an ArrayList to store all the json values. Now I want to retrieve a value from that ArrayList so that the OnClickListner() will get that value and from that value the detailed view will be displayed..

I am using AsyncTask to retrieve all the json values

@Override
protected String doInBackground(String... DATA) {
if(rqst_type.equals("top5"))
    {
        String url = DATA[1];
        JsonParser jParser = new JsonParser();
        JSONObject json = jParser.getJSONfromUrl(url);
        try
        {
            JSONArray top5 = json.getJSONArray(TAG_TOP5);
            public static ArrayList<HashMap<String, String>> top5List = new ArrayList<HashMap<String, String>>();
            top5List.clear();
            for(int i=0; i<top5.length(); i++)
            {
                Log.v(TAG_LOG, "Value of i: "+String.valueOf(i));
                JSONObject t = top5.getJSONObject(i);
                course_id = t.getString(TAG_CRSID);
                created_date = t.getString(TAG_CRTDATE);
                golfcourse_name = t.getString(TAG_GLFCRSNAME);
                facilities = t.getString(TAG_FCLTY);
                holes = t.getString(TAG_HOLES);

                HashMap<String, String> map = new HashMap<String, String>();
                map.put(TAG_CRSID, course_id);
                map.put(TAG_CRTDATE, created_date);
                map.put(TAG_GLFCRSNAME, golfcourse_name);
                map.put(TAG_FCLTY, facilities);
                map.put(TAG_HOLES, holes);

                top5List.add(map);
                Log.v(LoadingScreen.TAG_LOG, "top5List: "+String.valueOf(top5List));
            }
        }
        catch(JSONException e)
        {
            Log.v(TAG_LOG, String.valueOf(e));
        }
}

protected void onPostExecute(String result) {
    // TODO Auto-generated method stub
    super.onPostExecute(result);
    if(rqst_type.equals("top5"))
    {
        Intent in = new Intent(context, MyTop5.class);
        in.putExtra(TAG_CRSID, course_id);
        in.putExtra(TAG_CRTDATE, created_date);
        in.putExtra(TAG_GLFCRSNAME, golfcourse_name);
        in.putExtra(TAG_FCLTY, facilities);
        in.putExtra(TAG_HOLES, holes);
        Log.v(TAG_LOG, "Valuse to MyTop5: "+course_id+" "+created_date+" "+golfcourse_name+" "+
                facilities+" "+holes);
        context.startActivity(in);
    }

This is the file to where I am displaying the list and the onItenClickListner()..

 @Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.my_top5);

    Intent in = getIntent();
    golfcourse_name = in.getStringExtra(TAG_GLFCRSNAME);
    course_id = in.getStringExtra(TAG_CRSID);
    created_date = in.getStringExtra(TAG_CRTDATE);
    facilities = in.getStringExtra(TAG_FCLTY);
    holes = in.getStringExtra(TAG_HOLES);
    Log.v(LoadingScreen.TAG_LOG, "course id: "+String.valueOf(course_id));
    ListAdapter adapter = new SimpleAdapter(this, LoadingScreen.top5List, R.layout.top5_list,
            new String[] { TAG_GLFCRSNAME, TAG_CRSID, TAG_CRTDATE, TAG_FCLTY, TAG_HOLES },
            new int[] { R.id.top_golfname, R.id.top_courseid, R.id.top_createdate, R.id.top_fclty, R.id.top_holes });

    setListAdapter(adapter);
    Log.v(LoadingScreen.TAG_LOG, "course id: "+String.valueOf(course_id));
    ListView lv = getListView();

    lv.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
            // TODO Auto-generated method stub
            String url = "http://mygogolfteetime.com/iphone/viewdeal/127";
            new LoadingScreen(MyTop5.this).execute("view_detail", url);
        }
    });
}

In the given URL I want to change the 127 to the value which is stored in the top5List.

String url = "http://mygogolfteetime.com/iphone/viewdeal/127";

The value I am trying to find in the top5List is the value of “course_id“

Thanks in advance..

  • 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-09T22:31:49+00:00Added an answer on June 9, 2026 at 10:31 pm
    top5List.get(your position).get(your Key);
    

    With this code you can find the value on which you want to change.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to retrieve values from Json Object but getting Exception.I am trying
Hi I am trying to retrieve values from database. I have a row which
I have next problem, when I'm trying to retrieve value from xforms:select elements I
I am trying to retrieve the values from the following url: http://rentopoly.com/ajax.php?query=Bo . I
I am trying to retrieve some values from the registry. Here is the full
Using PHP. I'm trying to retrieve $_POST values from a the second dimension of
I'm having some issues trying to retrieve unique values from a DataSet in csharp,
I am trying to retrieve query string values from a url. And the app
I'm trying to retrieve some data from a JSON response, but this doesn't seem
I have a problem when trying to retrieve values from an array. I want

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.