I have a question about ListView
in ActionBarActivity
.I would like to display dummy data, but the bottom of the code below is
setListAdapter (this, ExampleItems);
There is an error in the error.
The error content is cannot resolve method 'setListAdapter'
Actually, I referred to the one I used in ListFragment
, but ActionbarActivity
seems to be different and I am having trouble.
Thank you for your cooperation.
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView (R.layout.example1);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// TODO:Delete dummy data
ExampleItems=new ArrayList<ExampleElement>();
int maxLength = 3;
for (inti=0; i<maxLength;i++) {
ExampleElement item = new ExampleElement();
item.setAccountName("UserName");
item.setImage(R.drawable.ic_launcher);
ExampleItems.add(item);
}
setListAdapter(this,ExampleItems);
}
ActionBarActivity
is not ListActivity
, so there is no setListAdapter()
method...
© 2024 OneMinuteCode. All rights reserved.