private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = (ListView) findViewById(R.id.listview);
final List<String> adapterData = new ArrayList<String>();
for (int i = 0; i < 20; i++) {
adapterData.add("ListItem" + i);
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_gallery_item, adapterData);
listView.setAdapter(adapter);
}