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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:34:10+00:00 2026-06-02T03:34:10+00:00

I got a crash with the following message: 04-17 11:18:19.855: W/dalvikvm(368): threadid=1: thread exiting

  • 0

I got a crash with the following message:

04-17 11:18:19.855: W/dalvikvm(368): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-17 11:18:19.925: E/AndroidRuntime(368): FATAL EXCEPTION: main
04-17 11:18:19.925: E/AndroidRuntime(368): java.lang.IllegalStateException: Could not execute method of the activity
04-17 11:18:19.925: E/AndroidRuntime(368):  at android.view.View$1.onClick(View.java:2072)
04-17 11:18:19.925: E/AndroidRuntime(368):  at android.view.View.performClick(View.java:2408)
04-17 11:18:19.925: E/AndroidRuntime(368):  at android.view.View$PerformClick.run(View.java:8816)
04-17 11:18:19.925: E/AndroidRuntime(368):  at android.os.Handler.handleCallback(Handler.java:587)
04-17 11:18:19.925: E/AndroidRuntime(368):  at android.os.Handler.dispatchMessage(Handler.java:92)
04-17 11:18:19.925: E/AndroidRuntime(368):  at android.os.Looper.loop(Looper.java:123)
04-17 11:18:19.925: E/AndroidRuntime(368):  at android.app.ActivityThread.main(ActivityThread.java:4627)
04-17 11:18:19.925: E/AndroidRuntime(368):  at java.lang.reflect.Method.invokeNative(Native Method)
04-17 11:18:19.925: E/AndroidRuntime(368):  at java.lang.reflect.Method.invoke(Method.java:521)
04-17 11:18:19.925: E/AndroidRuntime(368):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-17 11:18:19.925: E/AndroidRuntime(368):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-17 11:18:19.925: E/AndroidRuntime(368):  at dalvik.system.NativeStart.main(Native Method)
04-17 11:18:19.925: E/AndroidRuntime(368): Caused by: java.lang.reflect.InvocationTargetException
04-17 11:18:19.925: E/AndroidRuntime(368):  at com.UturpatShuPepper.LogCat.TheLogCatActivity.onGo(TheLogCatActivity.java:41)
04-17 11:18:19.925: E/AndroidRuntime(368):  at java.lang.reflect.Method.invokeNative(Native Method)
04-17 11:18:19.925: E/AndroidRuntime(368):  at java.lang.reflect.Method.invoke(Method.java:521)
04-17 11:18:19.925: E/AndroidRuntime(368):  at android.view.View$1.onClick(View.java:2067)
04-17 11:18:19.925: E/AndroidRuntime(368):  ... 11 more
04-17 11:18:19.925: E/AndroidRuntime(368): Caused by: java.lang.ClassCastException: android.app.Application
04-17 11:18:19.925: E/AndroidRuntime(368):  ... 15 more

I followed with the debugger and see the crash happens in the following code, in the marked line:

// Go button pressed
public void onGo(View v) {
    final EditText et = (EditText) findViewById(R.id.filters);
    String filter = "food\\s+[ABC]";
    if(!ValidateText(et, "^\\s*(" + filter + "(\\s+)" + filter + ")?$", "Bad filters")) {
        return;
    }
--->GlobalApp app = (GlobalApp) getApplication(); <--- CRASHES HERE
    for(int i = 0; i &lt; 100; i++) {
       app.addMessage("message number " + i);
    }

and according to the log it is caused by ClassCastException.

I defined GlobalApp class as follows:

public class GlobalApp extends Application {

private final ArrayList<String> messages = new ArrayList<String>();

public ArrayList<String> getMessages(){
    return messages;
}

public void addMessage(String msg){
    messages.add(msg);
}
}

Why is the casting wrong? What’s the right way to do it?

  • 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-02T03:34:11+00:00Added an answer on June 2, 2026 at 3:34 am

    In your manifest change this one

    <application android:icon="@drawable/icon" android:label="@string/app_name">
    

    with this one

    <application android:icon="@drawable/icon" android:label="@string/app_name" android:name=".GlobalApp">
    

    Since you have not stated the android:name for the the OS looks for the default Application class. In order to point it to your Application subclass you should use android:name attribute.

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

Sidebar

Related Questions

I got the following crash logs after my app crashes: 0 libobjc.A.dylib 0x000034f4 objc_msgSend
Sometimes I got a crash of my application with the following stack trace :
a user reported the following crash in my iPad app. Thread 0 name: Dispatch
I got the following crash report from iTunesconnect. Is the UIActivityIndicatorView bugged? Date/Time: 2009-09-26
I used the following script to symbolize the crash report I got from the
I got a crash report and the crashing thread's call stack all show Apple's
Got a crash report from a beta tester and I'm having trouble identifying the
I got this crash report from a remote user, but I cannot find any
I've got a crash in our app which I can't debug as one of
I got couple of crash reports like this one and I'm not sure what

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.