Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling another function from another class within the same main class in Android
    primarykey
    data
    text
    <p>I have a main Class i.e</p> <pre><code>Class A extends BroadcastReceiver { ClassB hello = new ClassB Public void onReceive(){ // Value obtained from Method in Class B String Message = hello.2ndFunction() } Class B extends Activity{ public String 2ndFunction(){ // 2ndFunction Lines...... } } } </code></pre> <p>This is my scenario. But i get the error</p> <pre><code> 06-20 09:17:02.584: E/AndroidRuntime(1076): FATAL EXCEPTION: main 06-20 09:17:02.584: E/AndroidRuntime(1076): java.lang.RuntimeException: Unable to start receiver com.example.timesheetcalculator.ReceiveSMS: java.lang.NullPointerException 06-20 09:17:02.584: E/AndroidRuntime(1076): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2383) 06-20 09:17:02.584: E/AndroidRuntime(1076): at android.app.ActivityThread.access$1500(ActivityThread.java:141) 06-20 09:17:02.584: E/AndroidRuntime(1076): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1310) 06-20 09:17:02.584: E/AndroidRuntime(1076): at android.os.Handler.dispatchMessage(Handler.java:99) 06-20 09:17:02.584: E/AndroidRuntime(1076): at android.os.Looper.loop(Looper.java:137) 06-20 09:17:02.584: E/AndroidRuntime(1076): at android.app.ActivityThread.main(ActivityThread.java:5041) 06-20 09:17:02.584: E/AndroidRuntime(1076): at java.lang.reflect.Method.invokeNative(Native Method) 06-20 09:17:02.584: E/AndroidRuntime(1076): at java.lang.reflect.Method.invoke(Method.java:511) 06-20 09:17:02.584: E/AndroidRuntime(1076): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 06-20 09:17:02.584: E/AndroidRuntime(1076): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 06-20 09:17:02.584: E/AndroidRuntime(1076): at dalvik.system.NativeStart.main(Native Method) 06-20 09:17:02.584: E/AndroidRuntime(1076): Caused by: java.lang.NullPointerException 06-20 09:17:02.584: E/AndroidRuntime(1076): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:99) 06-20 09:17:02.584: E/AndroidRuntime(1076): at com.example.timesheetcalculator.ReceiveSMS$CallLogsExtracter.CallLogs(ReceiveSMS.java:75) 06-20 09:17:02.584: E/AndroidRuntime(1076): at com.example.timesheetcalculator.ReceiveSMS.onReceive(ReceiveSMS.java:47) 06-20 09:17:02.584: E/AndroidRuntime(1076): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2376) </code></pre> <p>What could be the problem ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload