Home > Mobile >  For help! The null pointer bug & # x27; Boolean android.graphics.Bitmap.com press 'how to chang
For help! The null pointer bug & # x27; Boolean android.graphics.Bitmap.com press 'how to chang

Time:10-24

Changed for a few days didn't find correct modification method, help!!!!!!
Recently in to see a demo, when open the photo album will be submitted to the null pointer exception system

This is abnormal information



This is point to the error code

In a different version of the simulator, can enter the system photo album, but click on the picture and quote the null pointer exception, what's going on?
All permissions can add added, is to dynamic application permissions or other problems? How to change? Card for several days, help!!!!!!

CodePudding user response:

Quote: refer to 1st floor leonUI response:

,,,,,,, ask for help

CodePudding user response:

Bitmap is null
His check how to get the bitmap,

CodePudding user response:

The
reference 3 floor jklwan response:
bitmap is null
Check how to get the bitmap,

I really don't know what happened, for help ah,,,

CodePudding user response:

The
reference 3 floor jklwan response:
bitmap is null
Check how to get the bitmap,

What happened here?

CodePudding user response:

Your post code, click event there problem is not save here

CodePudding user response:

refer to 6th floor travel snail reply:
your post code, click event there problem is not save here

CodePudding user response:

CompressImageFromFile returned bitmap is null
//the higher the value, the lower the image pixel 
//int inSampleSize=8;
BitmapFactory. Options Options=new BitmapFactory. Options ();
Options. InJustDecodeBounds=false;
//to true when the image doesn't really, but get images of high wide information,
//options. InJustDecodeBounds=true;

Options. InSampleSize=inSampleSize;//sampling rate
Bitmap Bitmap=BitmapFactory. DecodeFile (filePath, options);

CodePudding user response:

refer to the eighth floor gxh_apologize response:
compressImageFromFile returned bitmap is null
//the higher the value, the lower the image pixel 
//int inSampleSize=8;
BitmapFactory. Options Options=new BitmapFactory. Options ();
Options. InJustDecodeBounds=false;
//to true when the image doesn't really, but get images of high wide information,
//options. InJustDecodeBounds=true;

Options. InSampleSize=inSampleSize;//sampling rate
Bitmap Bitmap=BitmapFactory. DecodeFile (filePath, options);

Changed or no effect, but still thank you

CodePudding user response:

references 9 f weixin_39102090 response:
Quote: refer to the eighth floor gxh_apologize response:

CompressImageFromFile returned bitmap is null
//the higher the value, the lower the image pixel 
//int inSampleSize=8;
BitmapFactory. Options Options=new BitmapFactory. Options ();
Options. InJustDecodeBounds=false;
//to true when the image doesn't really, but get images of high wide information,
//options. InJustDecodeBounds=true;

Options. InSampleSize=inSampleSize;//sampling rate
Bitmap Bitmap=BitmapFactory. DecodeFile (filePath, options);

Changed or no effect, but still thank you ha
b: ok, you are debugging, which line of code has a problem, take a look at this compressImageFromFile, anyway the bitmap finally is null before the code above is my code, I am a bitmap can be generated

CodePudding user response:

Android 7.0 cannot be used directly after the uri. Fromfile refer to this, there are other configuration items baidu the
 
Uri the Uri=null;
If (Build) VERSION) SDK_INT & gt;=Build. VERSION_CODES. N) {
Uri=FileProvider. GetUriForFile (this, getPackageName () + ". FileProvider ", the file).
} else {
Uri=uri. FromFile (file);
}

CodePudding user response:

, step by step, the best way is to debug, go see compressed bitmap method in which one has a problem, if the file exists, the file is valid, whether high wide to 0, whether to have permissions, and so on,

CodePudding user response:

Version of the estimation is permission problems, pay attention to the phone after 9.0,

CodePudding user response:

Show the imageView is custom, in the view of custom controls to rewrite the ontouch method, conducted in ontouch catch this exception with respect to ok,
  • Related