Shailendra Singh Rajawat
Shailendra Singh Rajawat

Reputation: 8242

open gallery google glass

I want to launch gallery to pick an image in my google glass app. for android mobile it is straight

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, REQ_SELECT_FILE);

when i am running same code in glass, it fails with error

07-29 16:12:45.941: E/AndroidRuntime(15847): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.GET_CONTENT }

Seems related Component is not part of gdk. then what should be the alternative. i sure they must provided some other way to use images saved on device. any pointer around that wd be appreciated.

Upvotes: 0

Views: 175

Answers (2)

Prisoner
Prisoner

Reputation: 50701

Concur with what @w9jds has said. It sounds like you're thinking about your app in a fairly non-glass-like way. If you re-think it, it might still do what you want, work better on Glass, and be a better user experience.

If you're looking at sharing or sending a picture, for example, it might make sense to leverage the Contacts that are provided by the Mirror API. People can take a picture and then share it to your service or to contacts that your service has provided to Glass. It takes care of making sure that the upload succeeds so you don't need to.

Even if you're not using this for some reason, it is a model that you should likely adopt. Your app should guarantee the upload succeeds (eventually) so the user should never have to retry it. You can implement the horizontal scrolling to select a picture that your app generated. There is currently no pre-provided tool to do this in a GDK app.

Look at and use the existing Glassware as a model. They were designed the way they were for a reason.

Upvotes: 2

w9jds
w9jds

Reputation: 897

There is no gallery on glass to select images, documents, or anything. (technically this intent doesn't exist on glass) Glass is a glance based system so they don't include systems that are in android that cause the user to interact with the device for extended periods of time.

If you want to select an image you are going to have to build it yourself, but chances are it probably shouldn't be in a glass app to begin with so Google will probably request you to remove it anyway.

Upvotes: 5

Related Questions