One intent is working, second is giving me a crash
- by user1480742
ok, so both intents receiver sides are on the same activite and they are sending from different ones....second one is not working, first one does, dont know why...all 3 activites are ok in manifest and all that
//second intent on senders side
public void onItemSelected(AdapterView<?> arg0, View users, int i,
long l) {
FILENAME = (adapter.getItem(i)).toString();
Bundle viewBag2 = new Bundle();
viewBag2.putString("profile_name", FILENAME);
Intent b = new Intent(OptionsMenu.this, CoreActivity.class);
b.putExtras(viewBag2);
startActivity(b);
}
//second intent on receiver side
private void Data_transfer() {
Bundle gotbasket2 = getIntent().getExtras();
profileName = gotbasket2.getString("profile_name");
}
//first (working intent) on senders side
public void onClick(View v) {
Bundle viewBag = new Bundle();
viewBag.putString("spinner_result", s);
a.putExtras(viewBag);
}
//first (working intent) on receiver side
private void Data_transfer() {
// TODO Auto-generated method stub
Bundle gotbasket = getIntent().getExtras();
x = gotbasket.getString("spinner_result");
}
06-26 20:22:09.787: D/AndroidRuntime(1802): Shutting down VM
06-26 20:22:09.787: W/dalvikvm(1802): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-26 20:22:09.847: E/AndroidRuntime(1802): FATAL EXCEPTION: main
06-26 20:22:09.847: E/AndroidRuntime(1802): java.lang.RuntimeException: Unable to start activity ComponentInfo{mioc.diver/mioc.diver.CoreActivity}: java.lang.NullPointerException
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.os.Looper.loop(Looper.java:123)
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-26 20:22:09.847: E/AndroidRuntime(1802): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 20:22:09.847: E/AndroidRuntime(1802): at java.lang.reflect.Method.invoke(Method.java:507)
06-26 20:22:09.847: E/AndroidRuntime(1802): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-26 20:22:09.847: E/AndroidRuntime(1802): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-26 20:22:09.847: E/AndroidRuntime(1802): at dalvik.system.NativeStart.main(Native Method)
06-26 20:22:09.847: E/AndroidRuntime(1802): Caused by: java.lang.NullPointerException
06-26 20:22:09.847: E/AndroidRuntime(1802): at mioc.diver.CoreActivity.Data_transfer(CoreActivity.java:189)
06-26 20:22:09.847: E/AndroidRuntime(1802): at mioc.diver.CoreActivity.onCreate(CoreActivity.java:88)
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-26 20:22:09.847: E/AndroidRuntime(1802): ... 11 more