Reputation: 27
If put the following code in dialog, an error occurs
If put the following code in dialog, an error occurs
If put the following code in dialog, an error occurs
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
}
});
Upvotes: 0
Views: 256
Reputation: 316
Please change the code with the below one.
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);
}
});
Upvotes: 2
Reputation: 1728
use intent
not intent()
change startActivity(intent());
to startActivity(intent);
Upvotes: 2