Search code examples
javaandroidinstagram-api

How to open instagram launcher activity from another app


 Intent hashtagIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("com.instagram.android"));
            startActivity(hashtagIntent);

I'm trying to launch the instagram app from my app. I have tried the code above, but it failed to open the Instagram app.


Solution

  • Try This

    It will help you definitely

    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.instagram.android");
    if (launchIntent != null)
    {
        try
        {
            startActivity(launchIntent);
        }
        catch (ActivityNotFoundException ex) // in case Instagram not installed in your device
        {
            ex.printStackTrace();
        }
    }