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 7801011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:49:15+00:00 2026-06-02T00:49:15+00:00

App reads JSON data. Then it would put it to whe listview (correctly) but

  • 0

App reads JSON data. Then it would put it to whe listview (correctly) but after pressing an item I would always get the same value showed. Below the code where I think is the problem but I can’t find one.

try{
    JSONArray jArray = new JSONArray(result);
    for(int ii=0;ii<jArray.length();ii++){
            JSONObject json_data = jArray.getJSONObject(ii);
            courseName = json_data.getString("fullname");

            HashMap<String,String> map = new HashMap<String, String>();
            map.put("fullname", courseName);
            myCoursesList.add(map);
    }
} catch(JSONException e){
    Log.e("log_tag", "Error parsing data "+e.toString());
}
ListAdapter adapter = new SimpleAdapter(this, myCoursesList,R.layout.my_courses_layout,
        new String[] {"fullname"}, new int[] { R.id.course});

setListAdapter(adapter);
ListView lv = getListView();
lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(AdapterView<?> parent, View view, int position, long id){
        String fn = ((TextView)findViewById(R.id.course)).getText().toString();

        Intent in = new Intent(getApplicationContext(), courseActivity.class);
        in.putExtra("fullname", fn);
        startActivity(in);
    }
});
  • 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-02T00:49:17+00:00Added an answer on June 2, 2026 at 12:49 am

    Change this:

    String fn = ((TextView)findViewById(R.id.course)).getText().toString();
    

    To this:

    String fn = ((TextView)view.findViewById(R.id.course)).getText().toString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm testing an app that reads thousands of small objects and sends then back
I have an HTML (App) file that reads another HTML (data) file via jQuery.ajax()
I have a C# console app App1 that reads a row of data from
I'm having trouble getting JSON data from my Rails app to display on a
I have a Rails app that has 2 clients -- an iOS app reads/writes
I need to write an app that reads a config file with info on
I have successfully created an app that reads from a bundled .plist file and
What I have is a C# windows app that reads a bunch of SQL
I am trying to create an iPad app that reads a video on a
Help me, Stackoverflow! I have a simple .NET 3.5 console app that reads some

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.