prevent a new intent from being repeated on android

0

Hi, I'm trying to create an intent in android, but the objective is to check if the intent exists and if it exists, destroy it and call a new intent with different parameters, this is the calling code.

public void Safesearch(String urlgoogle){
        String urlString=(urlgoogle.concat("&safe=active"));
        Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(urlString));
        intent.setPackage("com.android.chrome");
        try {
            startActivity(intent);
        } catch (ActivityNotFoundException ex) {
            intent.setPackage(null);
            startActivity(intent);
        }
    }
    
asked by Nelson Redondo Barros 09.03.2018 в 00:23
source

0 answers