【问题标题】:Link to page in Instagram app链接到 Instagram 应用中的页面
【发布时间】:2014-02-04 20:18:26
【问题描述】:

我有一个 android 应用程序,如果用户安装了它,我想在 textview 中设置一个链接以打开一个 instagram 页面。如果没有,它会打开网页。

我知道如何检查应用程序是否已安装,但我不知道如何打开它并将其重定向到我想要的特定页面

        boolean instagram = false;

        try {
            ApplicationInfo info = getActivity().getPackageManager().getApplicationInfo("com.instagram.android", 0);
            instagram = true;
            //open Instagram app and redirect to @ExamplePage
        } catch (PackageManager.NameNotFoundException e) {
            instagram = false;
            //open http://Instagram.com/ExamplePage
        }

文本视图

<TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="@string/follow_zamaaan_link"
            android:id="@+id/follow_instagram"
            android:layout_margin="10dp"
            android:layout_gravity="center_horizontal"
            android:textColor="@color/link_color"
            />

感谢任何帮助或指点。

【问题讨论】:

    标签: java android xml textview instagram


    【解决方案1】:

    给你:

              TextView myClickableUrl = (TextView) findViewById(R.id.txtview1);
              myClickableUrl.setText("Click on site: www.instagram.com");
              Linkify.addLinks(myClickableUrl, Linkify.WEB_URLS);
    

    【讨论】:

    • 感谢您的回复,但这并不能回答我的问题。如果用户安装了 Instagram,我希望 textview 链接到 Instagram 页面。我知道如何重定向到网页。
    猜你喜欢
    • 1970-01-01
    • 2014-07-10
    • 2021-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多