ListView Application

ListView application is use to show the data in the list format.

Step 1.

Create new application with any name from file menu option.
File → New Project → Application name → select API → Add Blank Activity → Activity Name → finish

Step 2.

In activity_main.xml layout file design your application.
Add following Controls:-

list view

Step 3.

Import Package and write following coding in class file.

    import android.widget.ArrayAdapter;
    import android.widget.ListView;

  public class MainActivity extends ActionBarActivity {

    ListView lt;
    String name[]={"Hello","Akhtra","Manzar","Shahid","Aayat"};
    protected void onCreate(Bundle savedInstanceState) {
        ArrayAdapter<String> ad= new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,name);

Step 4. Final Output

list view
Advertisement here

Share this Page.