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 Android Lists and Adapters (2015) Standard ListViews Displaying List Data (or None At All)

Sean Gallagher
Sean Gallagher
2,054 Points

Display List Data: onClick gets a fatal error, class not in manifest?

Got a strange error when I went back to try a list view again (was having trouble with CustomAdapter so switched to using this approach).

My app crashes when I click on click on the Daily Button. Logs says the "DailyActivity" class is not in the manifest (huh?). Didn't seem to have a problem when I built and Grundle found the class.

android.content.ActivityNotFoundException: Unable to find explicit activity class... {com.seattleshinebox.weatherapp/com.seattleshinebox.weatherapp.ui.TestList}; have you declared this activity in your AndroidManifest.xml?

Inside MainActivity I have: @OnClick (R.id.test_button) public void startTestActivity(View view) { Intent intent = new Intent(this,TestList.class); startActivity(intent); }

And in TestList I have: public class TestList extends ListActivity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    String[] day = {"Mon", "Tues", "Wed", "Thus"};
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, day);
    setListAdapter(adapter);

}

}

2 Answers

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Hi Sean,

In your project folder you should be able to find a file called "AndroidManifest.xml" Among other things you need to "list" all of your Activities. Could you post that file here?

Sean Gallagher
Sean Gallagher
2,054 Points

Yeah I'm not sure how but it was completely missing from the AndroidManifest. I created the java file the usual way.

So thanks for the tip. I just added this back in and it works now:

<activity
            android:name=".ui.TestList"
            android:label="@string/title_activity_list"
            android:parentActivityName=".ui.MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.seattleshinebox.weatherapp.ui.MainActivity" />
 </activity>