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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:13:14+00:00 2026-06-09T21:13:14+00:00

I get a list of objects from database, meanwhile it’s two parameters – title

  • 0

I get a list of objects from database, meanwhile it’s two parameters – title and datetime.
I’ve created a listView in main.xml and item.xml for each row in the list.
I get all list, place it to ArrayList (Map (String, Object)) and array list has all data when is placed into the adapter.

private void getAllNotesLocal () {

    manager = new NotesManager(this);
    lstNotes = manager.getAllNotes();
    ArrayList<Map<String, Object>> _notesList = new ArrayList<Map<String, Object>>(lstNotes.size());
    Map<String, Object> _map;
    for (NoteObj currNote : lstNotes) {
        _map = new HashMap<String, Object>();
        _map.put(Constants.ATTRIBUTE_NAME_TITLE, currNote.getName());
        _map.put(Constants.ATTRIBUTE_NAME_DATE, currNote.getDate());

        _notesList.add(_map);
    }

    String[] from = {Constants.ATTRIBUTE_NAME_TITLE, Constants.ATTRIBUTE_NAME_DATE};
    int[] to = { R.id.tv_name, R.id.tv_date};

    SimpleAdapter sAdapter = new SimpleAdapter(this, _notesList, R.layout.item, from, to);
    lvAllNotes = getListView();
    lvAllNotes.setAdapter(sAdapter);

}

But nothing happens in the screen.
When i use arrayAdapter everythin is OK except there is only one parameter I could place into each row.
The code that is works is here:

ListView lvAllNotes =  = getListView();
ArrayList<NoteObj> lstNotes = manager.getAllNotes();
ArrayAdapter<NoteObj> adapter = new ArrayAdapter<NoteObj>(this, R.layout.item, R.id.tv_name, lstNotes);
setListAdapter(adapter);

The main.xml:

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

The item.xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp" >

<TextView
    android:id="@+id/tv_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="top|left"
    android:layout_marginLeft="5dp"
    android:ellipsize="end"
    android:lines="1"
    android:scrollHorizontally="true"
    android:singleLine="true"
    android:text="@string/empty"
    android:textSize="18sp" />

<TextView
    android:id="@+id/tv_date"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|right"
    android:layout_marginRight="5dp"
    android:text="@string/empty"
    android:textSize="9sp"
    android:textStyle="italic" >
</TextView>

</FrameLayout>
  • 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-09T21:13:16+00:00Added an answer on June 9, 2026 at 9:13 pm

    I think the frame layout is the problem.
    This is because frame layout just shows a single view to the user.All the remaining views will be hidden below the first layout.
    So that the problem
    Any how happy to know that my solution helped in solving the issue.

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

Sidebar

Related Questions

I want to get a list of objects from the database between a given
I am trying to get a list of objects from the Database based on
I get from my database a list of objects with attributes. So I want
I've got a list of objects that I want to delete from the database.
I'm currently attempting to retrieve a list of objects from my database using jQuery.
I'm trying to populate a listviewactivity's list with objects returned from an DB40 database,
I am using the EF to get and create some objects from my database.
I have a template that displays a list of objects from the database. {%
I want to get a list of inner objects of a scala object. Sample
I would like to get collection or list of Item objects, but I get

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.