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 9138849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:18:37+00:00 2026-06-17T09:18:37+00:00

I am not able to switch to the listactivity from my main acitivity ,

  • 0

I am not able to switch to the listactivity from my main acitivity , i created the listactivity by watching an video tutorial and followed the same steps but as soon as i click on the button to switch to the menu i am getting error “Unfortunately the program has stopped working “

Button button1; 
    button1 = (Button)findViewById(R.id.but1);


    button1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent i = new Intent(MainActivity.this,Menu.class);
            startActivity(i);

The Menu class is as follows :

public class Menu extends ListActivity{
String classes[] = {"First","Second","Third"};

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setListAdapter(new ArrayAdapter<String>(Menu.this,android.R.layout.simple_list_item_1, classes));
}

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);
    String cheese=classes[position];
    try{
    Class ourClass=Class.forName("com.ashsoft.basiccprogram." + cheese);
    Intent ourIntent=new Intent(Menu.this,ourClass);
    startActivity(ourIntent);
    }catch(ClassNotFoundException e){

        e.printStackTrace();
    }

Logcat :

Log file : `01-13 13:53:03.481: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:03.481: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:03.481: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:04.511: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:04.521: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:05.602: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:05.602: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:05.681: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:05.771: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.001: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.071: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.071: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.181: I/Choreographer(1400): Skipped 68 frames!  The application may be doing too much work on its main thread.
01-13 13:53:06.362: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.442: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.491: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.501: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.511: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.532: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.581: D/gralloc_goldfish(1400): Emulator without GPU emulation detected.
01-13 13:53:06.702: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:06.851: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:16.741: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:16.782: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:16.801: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:16.801: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:16.872: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:16.911: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:16.931: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:16.951: W/Trace(1400): Unexpected value from nativeGetEnabledTags: 0
01-13 13:53:17.052: D/AndroidRuntime(1400): Shutting down VM
01-13 13:53:17.052: W/dalvikvm(1400): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
01-13 13:53:17.151: E/AndroidRuntime(1400): FATAL EXCEPTION: main
01-13 13:53:17.151: E/AndroidRuntime(1400): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.ashsoft.basiccprogram/android.view.Menu}; have you declared this activity in your AndroidManifest.xml?
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.app.Activity.startActivityForResult(Activity.java:3370)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.app.Activity.startActivityForResult(Activity.java:3331)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.app.Activity.startActivity(Activity.java:3566)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.app.Activity.startActivity(Activity.java:3534)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at com.ashsoft.basiccprogram.MainActivity$1.onClick(MainActivity.java:27)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.view.View.performClick(View.java:4202)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.view.View$PerformClick.run(View.java:17340)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.os.Handler.handleCallback(Handler.java:725)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.os.Handler.dispatchMessage(Handler.java:92)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.os.Looper.loop(Looper.java:137)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at android.app.ActivityThread.main(ActivityThread.java:5039)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at java.lang.reflect.Method.invokeNative(Native Method)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at java.lang.reflect.Method.invoke(Method.java:511)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-13 13:53:17.151: E/AndroidRuntime(1400):     at dalvik.system.NativeStart.main(Native Method)
01-13 13:53:25.911: I/Process(1400): Sending signal. PID: 1400 SIG: 9
`

Manifest code :

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.ashsoft.basiccprogram.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

     <activity
        android:name="com.ashsoft.basiccprogram.First"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.FIRST" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
        <activity
        android:name="com.ashsoft.basiccprogram.Menu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MENU" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>


</application>

The tutorial which i used did not use any xml file for the list.

Main problem is that the list is not showing up . Whenever i click on the button for menu from the main activity it stops working.

  • 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-06-17T09:18:38+00:00Added an answer on June 17, 2026 at 9:18 am

    It seems you haven’t registered that Menu class in your manifest file.

    If it still doesn’t work, post the logcat, so that there would be chances of having my answer edited.

    EDIT:

    First thing is your long process task must be sorrounded with asynctask.

    For the time being let us leave that. Just try this:

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.ashsoft.basiccprogram.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
    
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    
         <activity
            android:name="com.ashsoft.basiccprogram.First"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.FIRST" />
    
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
            <activity
            android:name=".ListScreenActivity"
            android:label="@string/app_name" >
    
        </activity>
    

    Your ListScreenActivity:

    public class ListScreenActivity extends ListActivity{
    String classes[] = {"First","Second","Third"};
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
    
    
        setListAdapter(new ArrayAdapter<String>(ListScreenActivity.this,android.R.layout.simple_list_item_1, classes));
    
    
                   ListView listView = getListView();
               listView.setTextFilterEnabled(true);
    
    
    
    
    listView.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id) {
                   //show toast
                    Toast.makeText(getApplicationContext(),"Clicked on "+classes[position], Toast.LENGTH_SHORT).show();
                }
            });
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not able to download artifacts from central maven repository. <mirrors> <!-- mirror | Specifies
I am not able to switch to pretty permalinks in WAMP. Changing to any
Here is my code. I am not able to call my receiver class from
I'm not able to get the correct video duration/length (in seconds) of a loaded/cued
I am trying to compile my code but I am not able to compile
I'm trying to pass a UILabel with AudioServicesAddSystemSoundCompletion but i'm not able to manipulate
I'm new to maven build tool, but I'm not able to configure maven for
I saw some related questions on SO, but I'm not able to resolve my
I am not able to switch the current Ruby version: ➜ ~ rvm list
This seems to be an easy question to ask, but I am not able

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.