Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Relating Users in Parse.com Removing Friend Relationships

Matthew Moyer
Matthew Moyer
11,396 Points

No Action Bar on the edit user page.

There is no Action Bar on the edit user page. I'm sure it is because EditFriendsActivity extends ListActivity and not ActionBarActivity but I'm not sure how to fix. Help & thanks.

2 Answers

Henrik Hansen
Henrik Hansen
23,176 Points

You could make it extend ActionBarActivity instead. Then set a ListView in the layout and use that one instead. Worked for me.

You will have to change some parts of the code thou. You cannot use getListView(), use

mListView = (ListView) findViewById(R.id.recipients_list);

 ArrayAdapter<String> lvAdapter = new ArrayAdapter<String>(
                                RecipientsActivity.this,
                                android.R.layout.simple_list_item_checked,
                                usernames);

mListView.setAdapter(lvAdapter);

mListView.setOnItemClickListener(new ListView.OnItemClickListener() {
       @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                                      // Some code...
         }
  };

I think there are other methods you have to change as well.

Beatriz Macedo
Beatriz Macedo
9,903 Points

Thank you! I was having the same problem and this worked great!

For those of you using android studio and realizing that ActionBarActivity is deprecated you can follow the above guide with the only difference being extend AppCompatActivity.