RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Virtual Machine.
63
votes
7answers
24k views
Java: checked vs unchecked exception explanation
I have read multiple posts on StackOverFlow about checked vs unchecked exceptions. I'm honestly still not quite sure how to use them properly.
Joshua Bloch in "Effective Java" said that
Use ...
33
votes
4answers
27k views
Calling startActivity() from outside of an Activity?
I'm using an AlarmManager to trigger an intent that broadcasts a signal. The following is my code:
AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent i = new ...
7
votes
1answer
5k views
Set a menu item as checked from code
I have an Android application with the following menu item in one of the Activities (which concerns handling a list of names and mac numbers):
<item android:id="@+id/menu_sort_tagg"
...
6
votes
4answers
2k views
Java RuntimeException equivalent in C#?
Does C# have the equivalent of Java's java.lang.RuntimeException?
(I.E. an exception that can be thrown without the necessity of being caught, or the program crashing when the exception is thrown.) ...
6
votes
2answers
214 views
Android App crashes on Release Build with the use of Proguard and Dagger
I'm new to the use of Proguard and Dagger for Android apps, so I would really appreciate if someone could give me a few pointers.
Proguard and Dagger have been implemented into the application. When ...
5
votes
1answer
460 views
Guava EventBus: don't catch RuntimeException
I use guava's EventBus, unfortunately it catches and logs the InvocationTargetException that occurs when an event-handler throws a RuntimeException. Can i disable this behaviour?
5
votes
3answers
1k views
BluetoothAdapter.getDefault() throwing RuntimeException while not in Activity
When I'm trying to get default bluetooth adapter while i'm NOT in Activity, but in TimerTask (created inside Service) by using:
BluetoothAdapter.getDefaultAdapter();
I get the following exception:
...
4
votes
2answers
170 views
int i=99 is working however int i = 099 not working
In Java, I noticed that when I write
int i = 99;
it works fine. However when I say
int i = 099;
I get an exception:
java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: ...
4
votes
3answers
336 views
Is it possible to catch all exceptions except runtime exceptions?
I have a statement that throws a lot of checked exceptions. I can add all catch blocks for all of them like this:
try {
methodThrowingALotOfDifferentExceptions();
} catch(IOException ex) {
...
4
votes
5answers
6k views
Android RuntimeException onCreateDialog did not create a dialog for id
I've an application that you can show and close several Dialogs with:
showDialog(...)
removeDialog(...)
I play a little bit with the application and when there is no any Dialog on the screen, I ...
4
votes
4answers
2k views
Uncaught RuntimeException and finally clause: which comes first?
A RuntimeException is thrown in try block without being caught, while the finally clause invokes System.exit().
public static void main(String[] args) {
try {
...
4
votes
2answers
4k views
java.lang.RuntimeException: Unable to instantiate service .GCMIntentService
I'm trying to learn how to set a client receiver using the google cloud messaging system and i'm following this Google's tutorial: http://developer.android.com/guide/google/gcm/gs.html#android-app
I ...
4
votes
2answers
2k views
Custom notification: java.lang.RuntimeException: bad array lengths
I'm trying to use custom notifications in my Android application using Google's sample from here (section Creating a Custom Notification Layout).
Since I'm using this exact code I got a ...
4
votes
1answer
140 views
Method Over riding and Inheritance and Exceptions
Can a method in a subclass override a method in the parent class and throw a run time exception when the method in the parent class throws no exception? Something like this:
class X { public void ...
4
votes
2answers
5k views
Show/hide item in Action Bar Android (3.0+)
I'm using the built in action bar. I want to display in the action bar an animated loader while fetching data, and display a "refresh" icon when not. The simple way I found is to use 2 menu items and ...