Wednesday, 21 May 2014

ListView with checkbox

ListView with checkbox


                                       

1)Create a new android application project in eclipse 

2)Then after craeting a new project you have to edit the activity_mail.xml file , As shown below
                                                     

3)After editing the activity_main.xml file now you have to code the main activity  file as shown below
        
                           
Main Activity

package com.mobileapptech.listcheck;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ActionBarActivity {

String[] country = new String[] {
   "micromax",
   "samsung",
   "nokia",
   "xolo",
   "lenovo",
   "sony",
   "htc",
   "lg",
   "lava",
   "ericsson"
};
   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice, country);
       
       ListView listView = (ListView) findViewById(R.id.listview);
       listView.setAdapter(adapter);
       listView.setTextFilterEnabled(true);
   }



 4)Now the ListView with checkbox  is ready

                                                           
 


Related Posts:

  • ASIMO-Honda's Remarkable Humanoid Robot ASIMO-(It stands for Advance Step in Innovative Mobility)                                               &nbs… Read More
  • Withings Pulse O2 keep Track On Your Oxygen Levels Withings Pulse O2 keep  Track On Your Oxygen Levels As there was a competition in the fitness wearable ,withings produced a Blood Oxygen monitor to it new generation fitness tracker.  T… Read More
  • iOS How To Make iPhone Apps – An XCode 5 TutorialFor Beginners                              This is an XCode tutorial for beginners so we’ll be g… Read More
  • Expandable ListView - Android Expandable ListView:  Expandable ListView is used to group, that can individually expanded to show its children.  When the user touches the header it has the ability to expand and collapse the group.   In thi… Read More
  • Google Launches the Remote Desktop for Android-Remote Desktop Remote Desktop-Google launches the Remote Desktop for Android Now you can control your PC through SamrtPhone,a great news for  Android user now you can easily control and get access to your PC Desktop Computer … Read More

0 comments:

Post a Comment

Total Pageviews

26,785

Contact Form

Name

Email *

Message *

Mobile App Developer