Intent to open Instagram user profile on Android

I solved this problem using the following code.

Uri uri = Uri.parse("http://instagram.com/_u/xxx");
Intent likeIng = new Intent(Intent.ACTION_VIEW, uri);

likeIng.setPackage("com.instagram.android");

try {
    startActivity(likeIng);
} catch (ActivityNotFoundException e) {
    startActivity(new Intent(Intent.ACTION_VIEW, 
        Uri.parse("http://instagram.com/xxx")));
}

Leave a Comment