Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6059433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:42:35+00:00 2026-05-23T08:42:35+00:00

I am crashing trying to launch a sub-activity. I have a small app to

  • 0

I am crashing trying to launch a sub-activity. I have a small app to demonstrate the problem. The main part of the app is a list view, and when you click on an item in the list view it is supposed to launch an activity which brings up a gallery view. The app crashes before onCreate() is called for the gallery view class, so I suspect I have omitted some necessary thing in the xml for the activity description.

manifest:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="randombrand.ListGallery"
          android:versionCode="1"
          android:versionName="1.0">
        <uses-sdk android:minSdkVersion="7" />

        <application android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:label="@string/app_name" android:name=".ListGallery">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

            <activity android:label="Manual Top" android:name=".TestGallery">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>

        </application>
    </manifest>

java:

    public class ListGallery extends ListActivity
    {
        private static final String[] astrMainMenu = { "List Item 1", "List Item 2" };


        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);

            setListAdapter(new ArrayAdapter<String>(this, R.layout.main,
                    astrMainMenu));

            ListView lView = getListView();
            lView.setTextFilterEnabled(true);
        }

        @Override
        protected void onListItemClick(ListView l, View v, int position, long id)
        {
            Intent intent = new Intent();

            intent.setClass(this, TestGallery.class);

            startActivity(intent);
        }
    }

stack trace for crash when I call startActivity():

ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2417  
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2512   
ActivityThread.access$2200(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 119 
ActivityThread$H.handleMessage(Message) line: 1863  
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 123 
ActivityThread.main(String[]) line: 4363    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 521  
ZygoteInit$MethodAndArgsCaller.run() line: 860  
ZygoteInit.main(String[]) line: 618 
NativeStart.main(String[]) line: not available [native method]  

thanks in advance,

Jay

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:42:36+00:00Added an answer on May 23, 2026 at 8:42 am

    You should create Intent using next code:

    Intent intent = new Intent(this, TestGallery.class);
    

    Its not enough to just specify class name, your also need to specify package name where this class is located. In the above code example package name is taken from this (this is Context, and package name is taken via Context.getPackageName()).

    P.S. Note that under “package” I do not mean java’s package, I mean Android’s package. The one that is specified in AndroidManifest.xml file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to fix this problem for hours. My app keeps crashing
I'm trying to implement async on Android but it keeps crashing my app, the
I am trying to launch a new intent after I have loaded data. I
package com.ebonybutler.cexample3; import android.app.Activity; import android.content.Intent; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener;
My app (in fact, any app, even the sample ones) keep crashing when trying
When trying to show the UIImagePickerController I had strange problems with my app crashing
So my app is apparently crashing on launch. Your app crashed on both Wi-Fi
I am trying my first UINavigationController app and it is now crashing. If I
I am trying to include Growl support in an app, but it is crashing
Hey im trying to add countdown timers to an arraylist but it is crashing.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.