如果在对话框中输入以下代码,则会发生错误

如果在对话框中输入以下代码,则会发生错误

如果在对话框中输入以下代码,则会发生错误

CustomDialog.java

        public class CustomDialog extends Dialog {
        @BindView(R.id.dialog_button_app_quit) TextView quit;
        @BindView(R.id.dialog_button_app_quit_review) TextView review;
        @BindView(R.id.adView) AdView adView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_native_ad);
    ButterKnife.bind(this);

    AdRequest request = new AdRequest.Builder().build();
    adView.loadAd(request);

    quit.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            android.os.Process.killProcess(android.os.Process.myPid());
        }
    });

        review.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("market://details?id=com.xxxx.packageName"));
            startActivity(intent()); <----- error

        }
    });

最佳答案

使用intent而不intent()
startActivity(intent());更改为startActivity(intent);

关于java - startActivity(intent)方法调用预期错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56616021/

10-16 22:22