android - Start Activity after getting GPS Location -
how can start activity after have retrieved location of phone through gps? have splash screen dismiss after phone has gotten location of phone. have following code:
private locationlistener locationlistener = new locationlistener() { @override public void onlocationchanged(location location) { locmanager.removeupdates(this); intent intent = new intent(this, secondactivity.class); startactivity(intent); } @override public void onproviderdisabled(string provider) { } @override public void onproviderenabled(string provider) { } @override public void onstatuschanged(string provider, int status, bundle extras) { } }; after location retrieved remove updates , want start next activity. suggestions?
startactivity() needs context. if inside of activity try
intent intent = new intent(youractivity.this, secondactivity.class); youractivityname.this.startactivity(intent); if separate class need pass context class , use startactivity()
Comments
Post a Comment