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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:01:23+00:00 2026-06-12T00:01:23+00:00

I have the following code in an activity to send the user to a

  • 0

I have the following code in an activity to send the user to a different application:

public void goBack(View v) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setComponent(new ComponentName("com.example.android.lifecycle", "com.example.android.lifecycle.DialogActivity"));
    startActivity(intent);
}

The manifest file for the application is:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.android.lifecycle"
  android:versionCode="1"
  android:versionName="1.0">

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />
<application android:label="@string/app_name"
             android:icon="@drawable/ic_launcher">

    <activity android:name=".ActivityA"
        android:launchMode="singleTask">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="com.example.android.lifecycle" />
        </intent-filter>
    </activity>

    <activity android:name=".ActivityB" />

    <activity android:name=".ActivityC" />

    <activity android:name=".DialogActivity"
              android:theme="@android:style/Theme.Dialog">
        <action android:name="com.example.android.lifecycle" />
        <action android:name="android.intent.action.MAIN" />            
    </activity>

</application>
</manifest> 

However, when I click on the button which should send me to the new application, I get a message saying – The application has stopped unexpectedly. Please try again.

What am I doing wrong and how can I rectify this?

Thanks!!

09-27 14:08:42.763: E/AndroidRuntime(286): FATAL EXCEPTION: main
09-27 14:08:42.763: E/AndroidRuntime(286): java.lang.IllegalStateException: Could not execute method of the activity
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.view.View$1.onClick(View.java:2072)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.view.View.performClick(View.java:2408)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.view.View$PerformClick.run(View.java:8816)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.os.Handler.handleCallback(Handler.java:587)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.os.Handler.dispatchMessage(Handler.java:92)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.os.Looper.loop(Looper.java:123)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.app.ActivityThread.main(ActivityThread.java:4627)
09-27 14:08:42.763: E/AndroidRuntime(286):  at java.lang.reflect.Method.invokeNative(Native Method)
09-27 14:08:42.763: E/AndroidRuntime(286):  at java.lang.reflect.Method.invoke(Method.java:521)
09-27 14:08:42.763: E/AndroidRuntime(286):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-27 14:08:42.763: E/AndroidRuntime(286):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-27 14:08:42.763: E/AndroidRuntime(286):  at dalvik.system.NativeStart.main(Native Method)
09-27 14:08:42.763: E/AndroidRuntime(286): Caused by: java.lang.reflect.InvocationTargetException
09-27 14:08:42.763: E/AndroidRuntime(286):  at com.example.myfirstapp.DisplayMessageActivity.goBack(DisplayMessageActivity.java:30)
09-27 14:08:42.763: E/AndroidRuntime(286):  at java.lang.reflect.Method.invokeNative(Native Method)
09-27 14:08:42.763: E/AndroidRuntime(286):  at java.lang.reflect.Method.invoke(Method.java:521)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.view.View$1.onClick(View.java:2067)
09-27 14:08:42.763: E/AndroidRuntime(286):  ... 11 more
09-27 14:08:42.763: E/AndroidRuntime(286): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cmp=com.example.android.lifecycle/.DialogActivity } from ProcessRecord{450fce58 286:com.example.myfirstapp/10044} (pid=286, uid=10044) requires null
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.os.Parcel.readException(Parcel.java:1247)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.os.Parcel.readException(Parcel.java:1235)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.app.Activity.startActivityForResult(Activity.java:2817)
09-27 14:08:42.763: E/AndroidRuntime(286):  at android.app.Activity.startActivity(Activity.java:2923)
09-27 14:08:42.763: E/AndroidRuntime(286):  ... 15 more
  • 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-12T00:01:24+00:00Added an answer on June 12, 2026 at 12:01 am

    Add Intent.FLAG_ACTIVITY_NEW_TASK and Intent.FLAG_FROM_BACKGROUND flags with intent if you are starting New Application from Background as:

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    intent.setComponent(new ComponentName( "com.example.android.lifecycle","com.example.android.lifecycle.DialogActivity"));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    intent.setFlags(Intent.FLAG_FROM_BACKGROUND);
    startActivity(intent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within one Activity I have th following piece of code: public void onStartMonitoringToggleClicked(View v)
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
I have the following code to view a remotely hosted video file: startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(article.getLink())));
I have following code snippet in my application activity. If user is landing on
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
I have the following code in Main.java : public class Main extends Activity implements
I have the following code: public class TestSynch extends Activity { public static ArrayList<HashMap<String,String>>
i have executed the following code public class Activity_Threads_Handler extends Activity { private int
I have the following code in my activity. In my xml, the video view
I have following code: public class reader extends Activity { WebView mWebView; String mFilename;

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.