Android redmi solves the problem of reading images from local folders and obtaining paths,
 
In Android development, you can read images from local folders. Use the following code to open the image selection list:
 
Intent intent = new Intent();  intent.setAction(Intent.ACTION_PICK);  intent.setType("image/*");  startActivityForResult(intent, RESULT_LOAD_IMAGE);   
After selecting an image, in onActivityResult, we use the following code to obtain the selected image path:
 
Uri uri = data.getData();  String path = uri.getPath(); 
 
In this Code, I tested and found that there was no problem in testing on my Nexus 4, meizu, and simulator, But I tested it on red rice, Huawei, and other mobile phones, the obtained path value is not the path of the image on the mobile phone. We do not know what the value is. If we get the image based on this path, we will get a null value, why ???
 
Solution: In onActivityResult, you can use it on all mobile phones in the following way without any problems:
 
If (data! = Null) {Uri uri = data. getData (); if (! TextUtils. isEmpty (uri. getAuthority () {Cursor cursor = getContentResolver (). query (uri, new String [] {MediaStore. images. media. DATA}, null); if (null = cursor) {Toast. makeText (this, "image not found", Toast. LENGTH_SHORT ). show (); return;} cursor. moveToFirst (); path = cursor. getString (cursor. getColumnIndex (MediaStore. images. media. DATA); cursor. close ();} else {path = uri. getPath () ;}} else {Toast. makeText (this, "image not found", Toast. LENGTH_SHORT ). show (); return ;}