I have a method that scans the position and gets called on every activity I have, everytime an actions trigger I need to show an alertDialog, this is the code:
AlertDialog.Builder builder = new AlertDialog.Builder(mMainActivity.this);
builder.setMessage("test")
.setCancelable(false)
.setPositiveButton("go", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(mMainActivity.this,LocationDetails.class);
intent.putExtra("placeId",1);
startActivity(intent);
}
})
.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
But How can I create the alert on the current activity? Because now it only gets created on AlertDialog.Builder(mMainActivity.this);