我试图从如下视图中获取位图
View s = ml.getRootView();
s.setDrawingCacheEnabled(true);
Bitmap b = s.getDrawingCache();
System.out.println(b.isRecycled());
Log.e("ok","ok");
Intent i=new Intent(CameraActivity.this,Update.class);
i.putExtra("data",b);
startActivity(i);
// s.setDrawingCacheEnabled(false);
s.setVisibility(View.GONE);
finish();
I tried to transfer the bitmap from this Activity to another,but it is showing me black screen and app gets crashed.
s.setVisibility(View.GONE); If I dont give this statement it is showing me this modified Activity and then it is showing Black screen.
我认为传输此位图需要很多时间。
我该如何解决这个问题?
请帮忙
谢谢
出现黑屏后的Logcat
12-06 11:23:34.654: E/AndroidRuntime(16900): FATAL EXCEPTION: main
12-06 11:23:34.654: E/AndroidRuntime(16900): java.lang.NullPointerException
12-06 11:23:34.654: E/AndroidRuntime(16900): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2595)
12-06 11:23:34.654: E/AndroidRuntime(16900): at android.app.ActivityThread.access$1800(ActivityThread.java:124)
12-06 11:23:34.654: E/AndroidRuntime(16900): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985)
12-06 11:23:34.654: E/AndroidRuntime(16900): at android.os.Handler.dispatchMessage(Handler.java:99)
12-06 11:23:34.654: E/AndroidRuntime(16900): at android.os.Looper.loop(Looper.java:123)
12-06 11:23:34.654: E/AndroidRuntime(16900): at android.app.ActivityThread.main(ActivityThread.java:3806)
12-06 11:23:34.654: E/AndroidRuntime(16900): at java.lang.reflect.Method.invokeNative(Native Method)
12-06 11:23:34.654: E/AndroidRuntime(16900): at java.lang.reflect.Method.invoke(Method.java:507)
12-06 11:23:34.654: E/AndroidRuntime(16900): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-06 11:23:34.654: E/AndroidRuntime(16900): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-06 11:23:34.654: E/AndroidRuntime(16900): at dalvik.system.NativeStart.main(Native Method)
12-06 11:23:36.490: W/InputManagerService(1318): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40a84730