Tag: exception-handling

How to handle MonoDroid uncaught exceptions globally and prevent application from crash

I’m trying to implement valid exception handling in my monodroid app which is written with Xamarin.Android plugin for Visual Studio. I’m trying to handle 2 types of exceptions: at foreground (UI) thread at background (threadpool) thread In both cases at global handler I’m want to: Logging – (submitting analytics event) User Notification – (alert) After […]

Dealing with (cross-process) exceptions in Android custom content provider

I have a custom content provider in my Android app that works reasonably well. I expect other apps to also access my content provider. I would like some clean way to communicate exceptions and errors, but as far as I can tell the Android content provider framework doesn’t provide any way to propagate exceptions across […]

Handling full disk storage in Android

This question has evolved a bit from the initial one, here’s a short info: I filled up the disk storage on the emulator and got it absolutely useless – the process android.process.acore is displaying the “… has stopped unexpectedly” dialog in a loop, so nothing can be done on the system. I can’t even turn […]

Using global exception handling with “setUncaughtExceptionHandler” and “Toast”

I am trying to create a simple exception handler which will help me debug the application. Right now, when I have an exception I am forced to connect with Eclipse debugger merely to see the exception details. To avoid that I’ve used setUncaughtExceptionHandler to handle any unhandled exception and display a Toast on the exception. […]

Why does my exception handler not trap Android SQLite insert error?

I’m using SQLite for the first time, and am trying to learn its exception handling, so I’m forcing an insert error in my test app. The exception occurs and I see it written to the Eclipse LogCat output window. However it doesn’t get caught in the code. I’ve seen other questions here about being sure […]

Show a dialog in `Thread.setDefaultUncaughtExceptionHandler`

When my android application throw an exception, I want to show a custom dialog to tell user there is something wrong happened, so I use Thread.setDefaultUncaughtExceptionHandler to set a global exception handler: public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, final Throwable ex) […]

Catch all type exceptions programming Android

I’m developing an application for Android OS. Since this is my first application, I think I’ve committed some programming mistakes cause I hardly can trace bugs back to their causes. Thus, I was guessing, while i’m trying to fix bugs, is there a way to catch ALL types of exception in my entire activity lifecycle […]

Asynctask Error Handling

I am using AsyncTask to perform some background calculations but I am unable to find a correct way to handle exceptions. Currently I am using the following code: private class MyTask extends AsyncTask<String, Void, String> { private int e = 0; @Override protected String doInBackground(String… params) { try { URL url = new URL(“http://www.example.com/”); } […]

Exception message is null?

I have a try-catch statement in my code. In my catch block, I am calling e.getMessage() to print the message of the exception. However, e.getMessage keeps returning a null value. Interestingly, when I call e.printStackTrace, I have no problem printing the stack trace. Below is my code: try { console = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream())); }catch(Exception […]

How to fix NPE in ViewRoot#updateBidiOptions?

In the developer console on the Android market we are getting a lot of stack traces like this (sent in by users when our app crashes): java.lang.NullPointerException at android.view.ViewRoot.updateBidiOptions(ViewRoot.java:290) at android.view.ViewRoot.performTraversals(ViewRoot.java:737) at android.view.ViewRoot.handleMessage(ViewRoot.java:1792) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:143) at android.app.ActivityThread.main(ActivityThread.java:5068) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) at dalvik.system.NativeStart.main(Native Method) We have not been […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.