Marc Perry Marc Perry - 1 month ago 10
Android Question

How do I hide the status bar when starting a gallery intent

I start a Google's gallery intent in order to let users choose an image from their gallery. My app has the status bar hidden, but the gallery intent doesn't. This does not look nice when the intents are changed so I am hoping to also hide this in the gallery intent.

public void galleryClicked(View view){

Intent intent = new Intent(Intent.ACTION_PICK);

File pictureDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
String pictureDirectoryPath = pictureDirectory.getPath();

Uri data = Uri.parse(pictureDirectoryPath);

intent.setDataAndType(data, "image/*");

startActivityForResult(intent, GALLERY_REQUEST);
}

Answer

How do I hide the status bar when starting a gallery intent

You don't. You control the status bar in your app. The developers of the gallery app control the status bar in their app.

This does not look nice when the intents are changed

There are ~2 billion Android devices, made up of thousands of device models. Those devices will ship with hundreds of different gallery apps (or perhaps none at all), and users can install their own from the Play Store and elsewhere. Not all of them will "look nice" from your standpoint, whether with respect to the status bar or anything else (e.g., color scheme).

If you link to a third-party app, the behavior of that app is up to the developers of that app. If you want more control than that, do not link to a third-party app, but instead write your own gallery-style UI.

Comments