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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:33:29+00:00 2026-05-27T14:33:29+00:00

I am doing an contact list android application but i have a small problem

  • 0

I am doing an contact list android application but i have a small problem with my screens.
Here is my search.xml code:

  <?xml version="1.0" encoding="utf-8" ?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"             android:orientation="vertical" 
 android:layout_width="fill_parent"     
 android:layout_height="fill_parent">
 <LinearLayout 
 android:orientation="horizontal" 
 android:layout_width="fill_parent" 
  android:layout_height="wrap_content">
 <EditText android:id="@+id/searchText" 
 android:hint="@string/searchDefault"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content" 
  android:layout_weight="1" /> 
 <Button android:id="@+id/searchButton" 
 android:text="Search" 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" /> 
 </LinearLayout>
  <ListView
 android:id="@android:id/list"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" />

  </LinearLayout>
enter code here

Here is my detalii.xml:

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

    <TextView
            android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
     <ListView
            android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>


    </LinearLayout>

My problem is that my screen appears like image from below but i want detalii to appear on entire screen.I dont know what am i doing wrong.Could anybody give me a solution?

enter image description here

This is my search.java:

package org.example.dbcontactconsole;




  import android.app.ListActivity;
   import android.content.Intent;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.os.Bundle;
  import android.view.View;
   import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;

  import android.widget.ListView;
  import android.widget.SimpleCursorAdapter;
  import static android.provider.BaseColumns._ID;
    public class Search extends  ListActivity {

 private static int[] TO = {R.id.rowid,R.id.name, R.id.mobilephone, R.id.email };
private static String[] FROM = {_ID,DbConstants.NAME, DbConstants.PHONE, DbConstants.EMAIL, };
private Button sButton;

 private ListView lv1;
 private static SQLiteDatabase db;
  private DbCreate contacts;
  private Cursor cursor;
  private EditText searchText;
  protected SimpleCursorAdapter adapter;


protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);
    searchText=(EditText)findViewById(R.id.searchText);
    sButton=(Button)findViewById(R.id.searchButton);
    sButton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            showDatabaseContent();
              lv1 = getListView();

              lv1.setTextFilterEnabled(true);
        }
    });





    }


  private Cursor getContacts() {
      db = contacts.getReadableDatabase();
      cursor = db.rawQuery("SELECT  _id,name, phone, email FROM contactTest1 WHERE name LIKE ?", 
                new String[]{searchText.getText().toString()+"%"});
      startManagingCursor(cursor);
      return cursor;
         }

    public void showDatabaseContent(){
   contacts = new DbCreate(this); 
   try {
       cursor = getContacts(); 
       showContacts(cursor); 
   } finally {
       contacts.close(); 
       db.close();
   }
    }

    private void showContacts(Cursor cursor) {
   //set up data binding
   adapter = new SimpleCursorAdapter(this, R.layout.item, cursor, FROM, TO);
   setListAdapter(adapter);
   }

    public void onListItemClick(ListView parent, View v, int position, long id) {
   Intent abaintent = new Intent(this,Detalii.class);
   Cursor cursor = (Cursor) adapter.getItem(position);
   abaintent.putExtra("Contact_ID", cursor.getInt(cursor.getColumnIndex("_id")));
   startActivity(abaintent);
   }






  }

Here is my Detalii.java:

package org.example.dbcontactconsole;


      import java.util.ArrayList;
       import java.util.List;

     import android.app.ListActivity;
     import android.content.Intent;
      import android.database.Cursor;
       import android.database.sqlite.SQLiteDatabase;
       import android.net.Uri;
      import android.os.Bundle;
      import android.view.LayoutInflater;
      import android.view.View;
       import android.view.ViewGroup;
      import android.widget.ArrayAdapter;
       import android.widget.ListView;
      import android.widget.TextView;

               public class Detalii extends ListActivity
      { 
      protected TextView contactName;
      protected TextView contactPhone;
      protected TextView email;
      protected int contactId;
      protected  List<Actiune> actiune;
       protected ActiuneAdapter adapter;
      @Override
      public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
   setContentView(R.layout.detalii);

  contactId = getIntent().getIntExtra("Contact_ID",0);
   SQLiteDatabase db = (new DbCreate(this)).getWritableDatabase();
   Cursor cursor = db.rawQuery("SELECT name,phone,email FROM contactTest1 WHERE _id=?",new    String[]{""+contactId});

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

    contactName = (TextView) findViewById(R.id.name);
    contactName.setText(cursor.getString(cursor.getColumnIndex("name")));

   actiune= new ArrayList<Actiune>();
   String phoneString=cursor.getString(cursor.getColumnIndex("phone"));
   if (phoneString!=null)
   {
    actiune.add(new Actiune("Suna la numar",phoneString,Actiune.ACTION_CALL));
    }
   String stringemail = cursor.getString(cursor.getColumnIndex("email"));
   if (stringemail != null) {
           actiune.add(new Actiune("Email", stringemail,Actiune.ACTION_EMAIL));
           }
   adapter = new ActiuneAdapter();
   setListAdapter(adapter);
    }
    }
      public void onListItemClick(ListView parent, View view, int position, long id) {

        Actiune action = actiune.get(position);

       Intent intent;
     switch (action.getType()) {

    case Actiune.ACTION_CALL:  
            Uri callUri = Uri.parse("tel:" + action.getData());  
            intent = new Intent(Intent.ACTION_CALL, callUri);
        startActivity(intent);
            break;

    case Actiune.ACTION_EMAIL:  
    intent = new Intent(Intent.ACTION_SEND);
    intent.setType("plain/text");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[]{action.getData()});
    startActivity(intent);
    break;


       }
     }    

     class ActiuneAdapter extends ArrayAdapter<Actiune> {

     ActiuneAdapter() {
            super(Detalii.this, R.layout.actiune_detalii, actiune);
    }

     @Override
     public View getView(int position, View convertView, ViewGroup parent) {
    Actiune action = actiune.get(position);
    LayoutInflater inflater = getLayoutInflater();
    View view = inflater.inflate(R.layout.actiune_detalii, parent, false);
    TextView label = (TextView) view.findViewById(R.id.label);
    label.setText(action.getLabel());
    TextView data = (TextView) view.findViewById(R.id.data);
    data.setText(action.getData());
    return view;
    }

    }

    }
  • 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-27T14:33:30+00:00Added an answer on May 27, 2026 at 2:33 pm

    It looks like your Detalii activity has a dialog style set. If that is the case try changing it from this:

    <activity android:name=".Detalii" android:theme="@android:style/Theme.Dialog">
    

    to this:

    <activity android:name=".Detalii">
    

    This is just a guess since you didn’t post your manifest…

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

Sidebar

Related Questions

I am doing an contact list android application but i have a small problem
I have the below code which is suppose to show a list of contact
I'm doing a list of contacts for a person. I have an ItemsControl which
the following code seems to be incomplete or I am doing something wrong? problem
I have a Linked List that holds contact information(name, date of birth, etc...). I
This function is used to return a contact list for a users search input.
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing my first SL4 MVVM RIA based application and i ran into the following
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing some jquery animation. I have certain divs set up with an attribute of

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.