0

I used the google glass gdk web loading example

 void openWebPage(String url) {         
Uri webpage = Uri.parse(url);Intent intent = new Intent(Intent.ACTION_VIEW, webpage);       if (intent.resolveActivity(getPackageManager()) != null) 
   {
        startActivity(intent);      
    } 
}

to open custom websites based on the voice prompt. However when I swipe down to close the website, instead of closing the entire app it closes only the website and leaves the app with the main_activity window in the background. How do I load the website in the main activity card so that when I close the website nothing is left in the background?

yuva ツ
  • 3,707
  • 9
  • 50
  • 78

1 Answers1

0

Call finish() directly after startActivity:

if (intent.resolveActivity(getPackageManager()) != null) 
{
    startActivity(intent);
    finish();
}

This will finish (i.e., close) your activity so that the user will not return to it after closing the website.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443