java - Android Place Picker does not return to activity -
i have implemented placepicker
in app. have custom dialog pager in (like 2 tabs). second pager item has edittext
component. on touch of that, open placepicker. issue pressing on placepicker
, shuts app instead of going activity started.
this code placepicker
starts
public void showplacepicker() { try { placepicker.intentbuilder builder = new placepicker.intentbuilder(); startactivityforresult(builder.build(organizermainactivity.this), place_picker_request); } catch (googleplayservicesnotavailableexception e) { googleapiavailability.getinstance().geterrordialog(this, e.errorcode, place_picker_request).show(); e.printstacktrace(); } catch (googleplayservicesrepairableexception e) { googleapiavailability.getinstance().geterrordialog(this, e.getconnectionstatuscode(), place_picker_request).show(); e.printstacktrace(); } } @override public void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == place_picker_request) { if (resultcode == result_ok) { place selectedplace = placepicker.getplace(this, data); latlng values = selectedplace.getlatlng(); string loc = selectedplace.getaddress().tostring(); eventfilters.setlat(values.latitude); eventfilters.setlon(values.longitude); eventfilters.setlocation(loc); eventfilters.setuselocation(true); showfilterdialog(); } } }
the showplacepicker
function called location tab in dialog in way
@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view view = inflater.inflate(r.layout.fragment_filter_location, container, false); mprogressbar = (progressbar) view.findviewbyid(r.id.filter_location_progress); minputlocation = (textinputedittext) view.findviewbyid(r.id.filter_location_input_text); mcheckbox = (checkbox) view.findviewbyid(r.id.filter_location_checkbox); minputlocation.settext(eventfilters.getlocation()); mcheckbox.setchecked(eventfilters.shoulduselocation()); mcheckbox.setenabled(!eventfilters.getlocation().equals("")); inputlocationtouchhandler = new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { switch (event.getaction()) { case motionevent.action_down: mprogressbar.setvisibility(view.visible); minputlocation.setontouchlistener(null); mlistener.showplacepicker(); break; case motionevent.action_up: break; } return false; } };
even when select location, app shuts instead of going activity started.
could me out?
Comments
Post a Comment