Search code examples
android-activitycompiler-errors

How to get error from my app


Am using sketchware android IDE and if any error occurred they are showing in dailog box. It's a inbuid error In sketchware My question how can i show this error in Activity:

try {
    //code that may crash
} catch(Exception _e) {
    //here do something when try detects error
    Log.e("try/catch error", _e.toString());
}

But its not working. What could be the problem?


Solution

  • Do something like this.

    Example onbutton click:

    try {
    
    //Your Logic
    
    }
    
    catch(Exception e) {
    
    String ErrorMsg = e.toString();
    
    
    //ErroMsg Is your error value strore in string formate
    
    
    }