Android 如何将Google Play应用程序链接添加到应用程序?

Android 如何将Google Play应用程序链接添加到应用程序?,android,android-intent,google-play,uri,Android,Android Intent,Google Play,Uri,我已经发布了一个应用程序,现在我想更新它。我正在尝试添加一个按钮,将用户引导到我在Google Play上的另一个应用程序。如果我的用户喜欢当前的应用程序,我会建议他们下载我的另一个应用程序。我找到了这段代码,并在onCreate方法中添加到我的代码中 button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) {

我已经发布了一个应用程序,现在我想更新它。我正在尝试添加一个按钮,将用户引导到我在Google Play上的另一个应用程序。如果我的用户喜欢当前的应用程序,我会建议他们下载我的另一个应用程序。我找到了这段代码,并在onCreate方法中添加到我的代码中

button.setOnClickListener(new View.OnClickListener()

        {
            public void onClick(View v)
            {

                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("market://HTTPS://details?id=com.example.android"));
                startActivity(intent);
            }

        });
我还编写了xml部分和按钮定义。他们没有什么问题。 我编写了应用程序的包名,而不是com.example.android。Emulator崩溃,因为其中没有Googleplay。我在我的android设备上试过这个。它也崩溃了,我对此没有任何记录。你能给我的用户提供市场链接的其他方法吗?(应该直接在google play上打开我的应用程序,不应该访问该网站)

附言:我编辑了代码,它很有效。这是万一有人需要的话

button.setOnClickListener(new View.OnClickListener()

            {
                public void onClick(View v)
                {

                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse("market://details?id=com.example.android"));
                    startActivity(intent);
                }

            });
试试这个

  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setData(Uri.parse("market://details?id=com.example.android"));
  startActivity(intent);

编辑完问题后,它现在起作用了吗?