我想调用活动,用户可以在其中选择图片区域并将其设置为壁纸
我有一些问题。我的代码是:
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_ATTACH_DATA);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.background);
shareIntent.putExtra(Intent.EXTRA_STREAM, bitmap);
shareIntent.setType("image/jpeg");
startActivity(shareIntent);
但是当我选择设置为墙纸时,图库停止工作(Android 2.3),或者(Android 4.0)“设置为”菜单不显示。
Android 2.3 LogCat(com.cooliris.media 包中的此错误):
12-13 16:20:27.509: E/AndroidRuntime(14414): FATAL EXCEPTION: main
12-13 16:20:27.509: E/AndroidRuntime(14414): java.lang.NullPointerException
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2593)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.app.ActivityThread.access$1800(ActivityThread.java:123)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:953)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.os.Looper.loop(Looper.java:130)
12-13 16:20:27.509: E/AndroidRuntime(14414): at android.app.ActivityThread.main(ActivityThread.java:3835)
12-13 16:20:27.509: E/AndroidRuntime(14414): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 16:20:27.509: E/AndroidRuntime(14414): at java.lang.reflect.Method.invoke(Method.java:507)
12-13 16:20:27.509: E/AndroidRuntime(14414): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
12-13 16:20:27.509: E/AndroidRuntime(14414): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
12-13 16:20:27.509: E/AndroidRuntime(14414): at dalvik.system.NativeStart.main(Native Method)
12-13 16:20:27.529: W/ActivityManager(225): Force finishing activity com.cooliris.media/.Photographs
安卓 4.0 LogCat
12-13 11:26:44.722: E/JavaBinder(12822): !!! FAILED BINDER TRANSACTION !!!
对不起,我的英语不好。