📜  评论按钮 ade android studio - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:23.787000             🧑  作者: Mango

代码示例1
Button.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                final String myappPackageName = getPackageName(); // getPackageName() from Context or Activity object
                try {
                 startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + myappPackageName)));
                } catch (android.content.ActivityNotFoundException anfe) {
                 startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + myappPackageName)));
            }
        });