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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -