Closed turagabhupathi closed 5 years ago
may be this will solve` private Bitmap loadLargeBitmapFromView() { View v = getView(); Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height);
v.draw(c);
return b;
}`
` private Bitmap getBitmap() { Bitmap bitmap = null; if (isCrosswalk) { try { TextureView textureView = findCrosswalkTextureView((ViewGroup) getView()); bitmap = textureView.getBitmap(); } catch(Exception ignore) { } } else { View view = getView();
if(view.getDrawingCache()==null)
{
bitmap = loadLargeBitmapFromView();
}
else
{
bitmap = Bitmap.createBitmap(view.getDrawingCache());
}
// bitmap = Bitmap.createBitmap(view.getDrawingCache()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { bitmap.setHasAlpha(false); } view.setDrawingCacheEnabled(false); } return bitmap; } `
please help
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at android.graphics.Bitmap.createBitmap(Bitmap.java:791) at com.telerik.plugins.nativepagetransitions.NativePageTransitions.getBitmap(NativePageTransitions.java:724) at com.telerik.plugins.nativepagetransitions.NativePageTransitions.access$400(NativePageTransitions.java:27) at com.telerik.plugins.nativepagetransitions.NativePageTransitions$2.run(NativePageTransitions.java:167) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7076) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)