Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. AdapterView arrayAdapter = new AdapterView (this, android.R.layout.simple_list_item_1, family );
  2.  
  3. package com.example.mylist;
  4.  
  5. import android.os.Bundle;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.widget.AdapterView;
  8. import android.widget.ListAdapter;
  9. import android.widget.ListView;
  10.  
  11. import java.util.ArrayList;
  12.  
  13. public class MainActivity extends AppCompatActivity {
  14.  
  15. @Override
  16. protected void onCreate(Bundle savedInstanceState) {
  17. super.onCreate(savedInstanceState);
  18. setContentView(R.layout.activity_main);
  19.  
  20. ListView MyList = (ListView) findViewById(R.id.MyList);
  21.  
  22. ArrayList family = new ArrayList();
  23.  
  24. family.add("Abc");
  25. family.add("Def");
  26. family.add("Ghi");
  27.  
  28. AdapterView arrayAdapter = new AdapterView (this, android.R.layout.simple_list_item_1, family );
  29.  
  30. MyList.setAdapter((ListAdapter) arrayAdapter);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement