• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps RuntimeException Unable to start activity

josipj

Lurker
Hi All,

I'm having difficulty accessing a file in the raw folder. I trying to access the file using:

getResources().openRawResource(resourceId);

The class extends Application and I've added an activity to the AndroidManifest.xml as described below:

<activity android:name="com.josipjuric.delegates.impl.ResourceImpl" android:label="@string/app_name"/>

But I'm getting the following exception:

12-17 21:41:16.983: ERROR/AndroidRuntime(198): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.josipjuric.filemelder/com.josipjuric.filemelder.TrafficJamTabWidget}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.josipjuric.filemelder/com.josipjuric.filemelder.FileMelder}: java.lang.NullPointerException
12-17 21:41:16.983: ERROR/AndroidRuntime(198): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.josipjuric.filemelder/com.josipjuric.filemelder.FileMelder}: java.lang.NullPointerException
12-17 21:41:16.983: ERROR/AndroidRuntime(198): Caused by: java.lang.NullPointerException

I have added the class as attachement.

Does anybody have any suggestions?

Kind Regards,

J
 
I've build in a work around but I don't understand why I'm not able to get the application context using getApplicationContext(). It seems to me I should be able to get this from anywhere in the application. What I did is I simply passed the context along within the parameters untill it's in a method to is going to be using it.
 
Hi All,

I'm having difficulty accessing a file in the raw folder. I trying to access the file using:

getResources().openRawResource(resourceId);

The class extends Application and I've added an activity to the AndroidManifest.xml as described below:

<activity android:name="com.josipjuric.delegates.impl.ResourceImpl" android:label="@string/app_name"/>

But I'm getting the following exception:

12-17 21:41:16.983: ERROR/AndroidRuntime(198): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.josipjuric.filemelder/com.josipjuric.filemelder.TrafficJamTabWidget}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.josipjuric.filemelder/com.josipjuric.filemelder.FileMelder}: java.lang.NullPointerException
12-17 21:41:16.983: ERROR/AndroidRuntime(198): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.josipjuric.filemelder/com.josipjuric.filemelder.FileMelder}: java.lang.NullPointerException
12-17 21:41:16.983: ERROR/AndroidRuntime(198): Caused by: java.lang.NullPointerException

I have added the class as attachement.

Does anybody have any suggestions?

Kind Regards,

J

correct me if i'm wrong, but don't you mean your class extends activity?

also null pointer exception is pointing to FileMelder and TrafficJamTab so maybe its not referenced somewhere. thats about all i can tell, i'm not very advanced
 
Back
Top Bottom