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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:13:17+00:00 2026-05-29T10:13:17+00:00

I want to put two buttons in listView. public class Imenik extends ListActivity {

  • 0

I want to put two buttons in listView.

   public class Imenik extends ListActivity {

@Override
public long getSelectedItemId() {
 // TODO Auto-generated method stub
 return super.getSelectedItemId();
}

@Override
public int getSelectedItemPosition() {
 // TODO Auto-generated method stub
 return super.getSelectedItemPosition();
}
ListView lv;
Cursor Cursor1;

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

       //create a cursor to query the Contacts on the device to start populating a listview
    Cursor1 = getContentResolver().query(
      ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
      null,
         null,
         null,
         null);
    startManagingCursor(Cursor1);

       String[] from = {
         ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
         ContactsContract.CommonDataKinds.Phone.NUMBER,
         ContactsContract.CommonDataKinds.Phone._ID}; // get the list items for the listadapter could be TITLE or URI

 int[] to = {android.R.id.text1,
    android.R.id.text2}; //sets the items from above string to listview

 //new listadapter, created to use android checked template
 SimpleCursorAdapter listadapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_2, Cursor1, from, to );
 setListAdapter(listadapter);

 //adds listview so I can get data from it
 lv = getListView();
 lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

}

}

with this code I get all contacts names and numbers and put in the list, but I want two buttons and in every row checkBox, and user can click on item – mark checkBox and click confirm button to get those values in an array.
Help, thank you, Wolf.

  • 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-29T10:13:18+00:00Added an answer on May 29, 2026 at 10:13 am

    And again…

    Build a custom Adapter that uses your data…

    Whenever you want to do processing with the views in a ListView you
    need to create a custom adapter that will handle your logic
    implementation and pass that information to the views as necessary.

    Example

    http://android.vexedlogic.com/2011/04/02/android-lists-listactivity-and-listview-ii-%E2%80%93-custom-adapter-and-list-item-view/

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

Sidebar

Related Questions

I want to put two small buttons, one on left side ( info )
Im using a LinearLayout to put two buttons horizontally side-by-side, but I want to
I have two buttons in a horizontal field manager. one i want to put
I want to put facility to display distance between two places selected by user.
I'm using an UpdatePanel and want to put a CompareValidator on two text boxes,
hey, hi i want put limit on object creation means a class can have
I want to reference these two buttons, but am unsure how to reference them
What kind of panel should I use to put there two buttons - Next
I've projected an Intranet Ajax application and I want put it in a full
I have a page layout for my MOSS '07 site that I want put

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.