How to get Bitmap from an Uri?

Here’s the correct way of doing it: protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { Uri imageUri = data.getData(); Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri); } } If you need to load very large images, the following code will load it in in tiles (avoiding large memory … Read more

How to implement my very own URI scheme on Android

This is very possible; you define the URI scheme in your AndroidManifest.xml, using the <data> element. You setup an intent filter with the <data> element filled out, and you’ll be able to create your own scheme. (More on intent filters and intent resolution here.) Here’s a short example: <activity android:name=”.MyUriActivity”> <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category … Read more

Get real path from URI, Android KitKat new storage access framework [duplicate]

This will get the file path from the MediaProvider, DownloadsProvider, and ExternalStorageProvider, while falling back to the unofficial ContentProvider method you mention. /** * Get a file path from a Uri. This will get the the path for Storage Access * Framework Documents, as well as the _data field for the MediaStore and * other … Read more

Parse a URI String into Name-Value Collection

org.apache.http.client.utils.URLEncodedUtils is a well known library that can do it for you import org.apache.hc.client5.http.utils.URLEncodedUtils String url = “http://www.example.com/something.html?one=1&two=2&three=3&three=3a”; List<NameValuePair> params = URLEncodedUtils.parse(new URI(url), Charset.forName(“UTF-8″)); for (NameValuePair param : params) { System.out.println(param.getName() + ” : ” + param.getValue()); } Outputs one : 1 two : 2 three : 3 three : 3a

How are parameters sent in an HTTP POST request?

The values are sent in the request body, in the format that the content type specifies. Usually the content type is application/x-www-form-urlencoded, so the request body uses the same format as the query string: parameter=value&also=another When you use a file upload in the form, you use the multipart/form-data encoding instead, which has a different format. … Read more