1. Are you ready for the Galaxy S20? Here is everything we know so far!

Link doesn't go to Instagram app

Discussion in 'Android Development' started by SamoZain, Oct 5, 2014.

  1. SamoZain

    SamoZain Newbie
    Thread Starter

    I wanted to have a click to instagram in the application I'm making, the thing is, when I click on it, it goes to the browser, I wanted to go to Instagram natgeotravel application, if there was no Instagram application in my mobile, it goes to the browser
    Here is the code

    Code (Text):
    1. if (uri.contains("https://www.instagram.com/" )) {
    2.  String natgeotravel = "natgeotravel";
    3.  String uri1 = "instagram://Page/" + natgeotravel;
    4.  Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri1));
    5.  startActivity(intent);
    6.  
    7.  } else {
    8.  
    9.  String natgeotravel= "natgeotravel";
    10.  String uri1 = "https://www.instagram.com/" + natgeotravel;
    11.  Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri1));
    12.  startActivity(i);
    13.  }
    14.  }
    15.  });
    I even tried ! at the beginning of uri but still didn't work, it comes with a msg You must log out in order to reset your password and Sorry, we weren't able to load that link
    Help :)
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...