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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:43:23+00:00 2026-06-12T05:43:23+00:00

I want to have interface like this image So i create 2 file XML

  • 0

I want to have interface like this image

enter image description here

So i create 2 file XML Place and Place1

Code Place.xml:

<?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" >

<EditText
    android:id="@+id/filter_text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10" >
</EditText>

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

Code Place1.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/icon_place"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="7dp"
        android:src="@drawable/icon_landscapes" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="10" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="8"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/label_place"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:text="@+id/label_place" />

            <TextView
                android:id="@+id/label_address"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@+id/label_address" />
        </LinearLayout>

        <TextView
            android:id="@+id/label_Phone"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_marginTop="5dp"
            android:layout_weight="2"
            android:gravity="center"
            android:text="@+id/label_Phone" />
    </LinearLayout>
</LinearLayout>

</LinearLayout>

Here is code in activity class:

public class Place extends Activity {

private String DB_NAME = "Danang Travel.sqlite";

String[] from;
int[] to;

ListView lvPlace;
ArrayAdapter<String> adapterPlace;


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

    EditText filterEditText = (EditText) findViewById(R.id.filter_text);

    lvPlace = (ListView) findViewById(R.id.listView1);
    lvPlace.setTextFilterEnabled(true);

    // **********************************************************************
    SQLiteDatabase DB = null;
    Intent t = getIntent();
    Bundle extra = t.getExtras();
    String temp = extra.getString("k");
    try {
        DB = this.openOrCreateDatabase(DB_NAME, MODE_PRIVATE, null);

        Cursor c = DB.rawQuery(
                "SELECT Name,Address,Phone FROM ServiceDetail Where SerID = '"
                        + temp + "' ORDER BY Name", null);

        from = new String[]{"Name","Address","Phone"};
        to = new int[]{R.id.label_place,R.id.label_address,R.id.label_phone};

        SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,R.layout.place1, c, from, to);


        lvPlace.setAdapter(adapter);

It doesn’t work! I really don’t understand why? Please help me!

  • 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-12T05:43:24+00:00Added an answer on June 12, 2026 at 5:43 am

    I found this working sample code with ListActivity class, very useful for beginner. Just study it properly and implement in your code,

    Its simply read data from db and uses ArrayList class to store the values, and ArrayAdapter to set values in ListActivity.

    public class CRUDonDB extends ListActivity {
    
        private final String SAMPLE_DB_NAME = "myFriendsDb";
        private final String SAMPLE_TABLE_NAME = "friends";
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
    
            ArrayList<String> results = new ArrayList<String>();
            SQLiteDatabase sampleDB = null;
    
            try {
                sampleDB =  this.openOrCreateDatabase(SAMPLE_DB_NAME, MODE_PRIVATE, null);
    
                sampleDB.execSQL("CREATE TABLE IF NOT EXISTS " +
                        SAMPLE_TABLE_NAME +
                        " (LastName VARCHAR, FirstName VARCHAR," +
                        " Country VARCHAR, Age INT(3));");
    
                sampleDB.execSQL("INSERT INTO " +
                        SAMPLE_TABLE_NAME +
                        " Values ('Makam','Sai Geetha','India',25);");
                sampleDB.execSQL("INSERT INTO " +
                        SAMPLE_TABLE_NAME +
                        " Values ('Chittur','Raman','India',25);");
                sampleDB.execSQL("INSERT INTO " +
                        SAMPLE_TABLE_NAME +
                        " Values ('Solutions','Collabera','India',20);");
    
                Cursor c = sampleDB.rawQuery("SELECT FirstName, Age FROM " +
                        SAMPLE_TABLE_NAME +
                        " where Age > 10 LIMIT 5", null);
    
                if (c != null ) {
                    if  (c.moveToFirst()) {
                        do {
                            String firstName = c.getString(c.getColumnIndex("FirstName"));
                            int age = c.getInt(c.getColumnIndex("Age"));
                            results.add("" + firstName + ",Age: " + age);
                        }while (c.moveToNext());
                    } 
                }
    
                this.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,results));
    
            } catch (SQLiteException se ) {
                Log.e(getClass().getSimpleName(), "Could not create or Open the database");
            } finally {
                if (sampleDB != null) 
                    sampleDB.execSQL("DELETE FROM " + SAMPLE_TABLE_NAME);
                    sampleDB.close();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method on an interface that looks like this and I want
I have some code using libxml2's SAX2 interface. I want to be able to
In Interface Builder, I have a UITableView and I want to place a UIButton
I am trying to create an interface like the google maps. i.e. I want
I have an interface that I want to implement in separate classes after doing
I want to have a generic object that implements an interface. I mean if
i'm experimenting with django and the builtin admin interface. I basically want to have
I have a nice interface, and I want to implement one member of it
I have a set of objects that I want to conform to an interface,
I have 2 classes both inherit from the same interface. i want sometimes to

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.