android - How to show a window where a user can select the app they want to run -
i have app user can select date , open calendar add event or reminder that.
right using com.google.android.calendar
app. doing check see if installed. if not should let them select app want open. can tell me how this? im heard cant remember life of me called.
read this tutorial.
once have created intent , set info, call startactivity() send system. if system identifies more 1 activity can handle intent, displays dialog user select app use... if there 1 activity handles intent, system starts it.
also there option in dialog use selected action default.
however, if action performed handled multiple apps , user might prefer different app each time—such "share" action, users might have several apps through might share item—you should explicitly show chooser dialog...
this chooser dialog known app chooser.
in few words can show app chooser with:
string title = getresources().getstring(r.string.chooser_title); intent chooser = intent.createchooser(intent, title); if (intent.resolveactivity(getpackagemanager()) != null) { startactivity(chooser); }
where intent
calendar intent, example:
intent calendarintent = new intent(intent.action_insert, events.content_uri); calendar begintime = calendar.getinstance().set(2012, 0, 19, 7, 30); calendar endtime = calendar.getinstance().set(2012, 0, 19, 10, 30); calendarintent.putextra(calendarcontract.extra_event_begin_time, begintime.gettimeinmillis()); calendarintent.putextra(calendarcontract.extra_event_end_time, endtime.gettimeinmillis()); calendarintent.putextra(events.title, "new event"); calendarintent.putextra(events.event_location, "my house");
Comments
Post a Comment