开发者

Can't get Extras from Intent

I'm trying to get Extras from Intent but it causes an error

08-09 08:01:56.766: ERROR/AndroidRuntime(427): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=15, result=0, data=null} to activity {com.mroom.speeddial.widget.free/com.mroom.speeddial.widget.free.SpeedDialWidgetFreeConfigure}: java.lang.NullPointerException
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3515)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.access$2800(ActivityThread.java:125)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.os.Looper.loop(Looper.java:123)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at java.lang.reflect.Method.invokeNative(Native Method)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at java.lang.reflect.Method.invoke(Method.java:521)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at dalvik.system.NativeStart.main(Native Method)
08-09 08:01:56.766: ERROR/AndroidRuntime(427): Caused by: java.lang.NullPointerException
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at com.mroom.speeddial.widget.free.SpeedDialWidgetFreeConfigure.onActivityResult(SpeedDialWidgetFreeConfigure.java:306)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.app.Activity.dispatchActivityResult(Activity.java:3890)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3511)
08-09 08:01:56.766: ERROR/AndroidRuntime(427):     ... 11 more

I start the activity this way

Intent facebookIntent = new开发者_开发百科 Intent(this, FacebookSettings.class);
            startActivityForResult(facebookIntent, 15);

Then i do something in new activity and finaly end Activity this way

    public void onClick(View v) {
            //FBnames and FBIds are not null String arrays
            Intent data = new Intent();
            data.putExtra(FB_NAMES, FBnames);
            data.putExtra(FB_IDS, FBIds);
            setResult(RESULT_OK, data);
            finish();
    }

And I get an error. It doesn't even come to onActivityResult() in parent Activity.


Are you actually accepting the extras on the class you are sending them to? like this:

Bundle extras = getIntent().getExtras();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜