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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:06:20+00:00 2026-06-19T02:06:20+00:00

I am new to android. I want to show inserted data from database to

  • 0

I am new to android. I want to show inserted data from database to a table. I have used List to get the data.

 public List<user> getAllUsers() {
    List<user> users = new ArrayList<user>();

    Cursor cursor = database.query(SqlLiteHelper.TABLE_USER, allColumns, null, null, null, null, null);

    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
      user varUser = cursorToUser(cursor);

      //Log.v("user name",varUser.getName().toString());

      users.add(varUser);
      cursor.moveToNext();
    }
    //Log.v("user name",users.get(0).getName().toString());

    cursor.close();
    return users;
  }



   private user cursorToUser(Cursor cursor) {
    user varUser = new user();

    //Log.v("user id", cursor.getString(1).toString());

    varUser.setID(cursor.getLong(0));
    varUser.setName(cursor.getString(1));
    varUser.setPhone(cursor.getString(2));
    varUser.setEmail(cursor.getString(3));
    return varUser;
}

I wrote this code on UserDataSource.java

Then where i need to show those data i use the following codes

       databaseSource = new UserDataSource(this);
    databaseSource.open();

    List<user> values = databaseSource.getAllUsers();
    Log.v("information", values.get(0).getName().toString());
    ArrayAdapter<user> adapter = new ArrayAdapter<user>(this, android.R.layout.simple_list_item_1, values);
    setListAdapter(adapter);  

This is not adding the values in the list. I use the log.v to check whether the data is coming back or not. And i found that the data is coming perfectly from the database. Only when i try to print the List or insert it to the simple_list_item_1 then it is doing the problem.

It is printing

com.example.given_n_take.user@41221338

Buts its suppose to print the name from the database.

Database table name is user.

Please let me know what am i missing.

here is my xml file of layout where i am trying to add those list

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >


<Button
    android:id="@+id/all_user_back"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="10dp"
    android:text="Back" />



    <ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="384dp" >
</ListView>




</LinearLayout>
  • 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-19T02:06:21+00:00Added an answer on June 19, 2026 at 2:06 am

    If your list shows com.example.given_n_take.user@41221338 this means that you are missing a toString method in your user class. Implement a toString that returns the name of the user.

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

Sidebar

Related Questions

I am a new developer on Android and I want store user data in
I have the following problem. I want to read data from a Database in
I am new to Android development. I want to show user notification even when
Hi guys I am new to android...I want to display a dynamic list of
I am fairly new to android. I want to show two images back to
I want to show automatic checklist in android. For example I can have 4
I am new to android. I have an application which needs to show a
I'm new in Android programming and I want to find how to store data
I am new to Android programming and Threads. I want to get a picture
hi i am new android developer.i want to show image in viewFlipper.But it is

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.