Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Self-Destructing Message Android App Sending Messages Adding a Send Button

Extending ActionBarActivity and ListView? android studio 1.0

It seems like not extending ActionBarActivity will not implement the action bar but if I extend ActionBar I lose some of the functionality of listView.

How can i implement both?

9 Answers

Harry James
Harry James
14,780 Points

Hey Alejandro!

Sorry, I was a bit confused and thought you were extending just ActionBar.

I managed to reproduce this on my side and fixed it by setting the theme in AndroidManifest.xml like this:

android:theme="@android:style/Theme.Holo.Light.DarkActionBar" >

Hope it helps! :)

Harry James
Harry James
14,780 Points

That'd odd. I'm extending ActionBarActivity and am able to see the Action Bar.

In your AndroidManifest.xml file, are you using a specific theme?

Check the


attribute and see if it is AppTheme or not.

If that doesn't fix it, I recommend you try using SDK 21 and seeing if you can reproduce this.

If even after that you are reproducing the issue, you can always write a class extending ActionBarActivity inside of the class extending ActionBar but, this may be a bit of a confusing technique for starting off.

If nothing above fixed your problem, you could wait to see if someone else knows how to resolve this or, if you would like, I could see if I could reproduce it if you sent over your project files or, you could download the Project Files again from the course.

yes my app theme is Theme.AppCompat.Light.DarkActionBar

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"></style>

The thing is I am extending ListActivity because I have a list that I want to display but I also want to have the action bar. The problem right now is that I am extending ListActivity but I want to also have an action bar but I am not sure how to do that.

It seems like in Android Studio extending ListActivity will ignore the apptheme.

extended ActionBarActivity first then in your xml for the list do not use the default android list id, set the id for you list to some diffrent id of your choice then go back to your activity and refrence the id which you just changed

Adding the following to the activity in the Manifest file seems to do the magic.


How do you fix this replacing the theme with that line did not help...

i think you would have to try to set the actionbar in you code on each activity you want it to appear

since you are extending list, then it think within you code after you have initialized your actvivty view. it would how set the actionbar i your code. am not on my android devlopment. and it also depends if you want your actionbar to support api 8

Hi harry,

Do you think you can help me out.

my program compiles fine. I can take a picture or a 10 sec video. Then I press ok on the picture or video, Im able to choose my friends from a list of my added friends.

The problem is that there is no actionbar displayed and with no actionbar there is no send button displayed as it is involved with the actionbar. Since the release of this video things have been deprecated and the course is outdated.

Do you have any informantion on how to deal with my problem so i can move onto the next part.

Thank you, TheBigOso

here is my github https://github.com/TheBigOso/RibbitSendButton


package com.fartyou.thedirtyappstore.ribbit2;

import android.app.AlertDialog;
import android.app.ListActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseRelation;
import com.parse.ParseUser;
import java.util.List;

public class RecipientsActivity extends ListActivity {

    public static final String TAG = RecipientsActivity.class.getSimpleName();
    protected List<ParseUser> mFriends;
    protected ParseRelation<ParseUser> mFriendsRelation;
    protected ParseUser mCurrentUser;
    protected MenuItem mSendMenuItem;

    protected void onCreate(Bundle savedInstanceState) {

    public void onResume() {

        mCurrentUser = ParseUser.getCurrentUser();
        mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION);
        mFriendsRelation.getQuery().findInBackground(new FindCallback<ParseUser>() {
            public void done(List<ParseUser> friends, ParseException e) {

                if (e == null) {
                    mFriends = friends;

                    String[] usernames = new String[mFriends.size()];
                    int i = 0;
                    for (ParseUser user : mFriends) {
                        usernames[i] = user.getUsername();
                    ArrayAdapter<String> adapter = new ArrayAdapter<String>(
                } else {
                    Log.e(TAG, e.getMessage());
                    AlertDialog.Builder builder = new AlertDialog.Builder(RecipientsActivity.this);
                            .setPositiveButton(android.R.string.ok, null);
                    AlertDialog dialog = builder.create();


<?xml version="1.0" encoding="utf-8"?>


Harry James
Harry James
14,780 Points

Hey TheBigoso!

Thanks for the GitHub link there! I've gone ahead and forked your project.

I'll get back to you over on GitHub with a pull request for your project once I've fixed the issue for you :)

Awesome!!! your the best!!!