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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:46:15+00:00 2026-05-30T05:46:15+00:00

I’m trying to display a selected item in a listview, populated with SQLite in

  • 0

I’m trying to display a selected item in a listview, populated with SQLite in another activity, but when i make the rawQuery, using the _id row identifier to show it the item in the other activity, but does not send any results, leads me to the other activity, but did not shows anything in the xml layout, i don’t know if i’m doing correctly my declaration of rawQuery, this is my search code and my handler to show it:

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

    courseId = getIntent().getIntExtra("COURSE_ID", 0);
    SQLiteDatabase db = (new DBHelper(this)).getWritableDatabase();
    Cursor cursor = db.rawQuery("SELECT emp._id, emp.title, emp.instructor, emp.length, emp.rating, emp.topic, emp.subject, emp.description, mgr._id managerId, mgr.title managerTitle FROM courses emp LEFT OUTER JOIN courses mgr ON emp.title = mgr._id WHERE emp._id = ?", 
            new String[]{""+courseId});


    if (cursor.getCount() == 1)
    {
            cursor.moveToFirst();

            tTitle = (TextView) findViewById(R.id.tTitle);
            tTitle.setText(cursor.getString(cursor.getColumnIndex("title")));

            tInstructor = (TextView) findViewById(R.id.tInstructor);
            tInstructor.setText(cursor.getString(cursor.getColumnIndex("instructor")));

            tLength = (TextView) findViewById(R.id.tLength);
            tLength.setText(cursor.getString(cursor.getColumnIndex("length")));

            tRating = (TextView) findViewById(R.id.tRating);
            tRating.setText(cursor.getString(cursor.getColumnIndex("rating")));

            tTopic = (TextView) findViewById(R.id.tTopic);
            tTopic.setText(cursor.getString(cursor.getColumnIndex("topic")));

            tSubject = (TextView) findViewById(R.id.tSubject);
            tSubject.setText(cursor.getString(cursor.getColumnIndex("subject")));

            tDescription = (TextView) findViewById(R.id.tDescription);
            tDescription.setText(cursor.getString(cursor.getColumnIndex("description")));

    }
    db.close();
    cursor.close();
    return; 
}}

this is the class that shows the listview and performs the Intent:

public class lay_main extends ListActivity {
public ListView list;
public DBHelper myAdap;
protected SQLiteDatabase db;
public Cursor cursor;
DBHelper Context;
DBHelper ArrayList;

//adapter cAdapter class
protected ListAdapter adapter;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.lay_main);  

    collectXML();
    setupDataBase();
    setupAdapter();            
}      
private void collectXML() 
{
     list = (ListView)findViewById(android.R.id.list);  

}

public void setupDataBase() {
    myAdap = new DBHelper(getApplicationContext());
    myAdap.insertCourses();     

}

public void setupAdapter()
{
if(myAdap.getCourses()!=null)
    {
    adapter = new  cAdapter(this, R.layout.list_courses, myAdap.getCourses());
    list.setAdapter(adapter);
    }   
}
public void onListItemClick(ListView parent, View view, int position, long id) 
 {
        super.onListItemClick(parent, view, position, id);
        Intent intent = new Intent(this, CourseDetails.class);
        Courses course = (Courses) adapter.getItem(position);
        intent.putExtra("COURSE_ID", course.title);
        startActivity(intent);  
 }}

really would appreciate your help.

  • 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-05-30T05:46:17+00:00Added an answer on May 30, 2026 at 5:46 am

    You can send your data over an bundle:

    Bundle sendBundle = new Bundle();
        sendBundle.putString("COURSE_ID", course.title); //or use putInt if course.title is int type
        //sendBundle.putInt("COURSE_ID", course.title);
        Intent i = new Intent(lay_main.this, CourseDetails.class);
        i.putExtra("testBundle", sendBundle);
        startActivity(i);
    

    and recieve it like:

    Bundle receiveBundle = this.getIntent().getBundleExtra("testBundle");
        if (receiveBundle != null){
            String courseId = receiveBundle.getString("COURSE_ID");     
            //or int courseId = receiveBundle.getInt("COURSE_ID");     
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.