Hello.
How can i make a event that after you chose button from dialog
Thank you.
Hello.
How can i make a event that after you chose button from dialog
Thank you.
@User_Enforce There are 2 types of alert componenets which you can use:
The one from the niotron ide
Not the niotorn builder
@User_Enforce means you are trying to make an extension?
yes, its because I’m making an extension
Show us how you’re trying so that we might help you better.
@User_Enforce Can you share what you have tried so far…?
I’m making an extension of dialog with 3 buttons
Not even an cancellable button, but i can dismiss the dialog by clicking the outside of the dialog
I think this is that you’re trying to do.
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
public void showDialog(Context context) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Dialog Title");
builder.setMessage("Dialog Message");
// Set up the buttons
builder.setPositiveButton("Button 1", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which)
{
// Handle button 1 click
}
});
builder.setNeutralButton("Button 2", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which)
{
// Handle button 2 click
}
});
builder.setNegativeButton("Button 3", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Handle button 3 click
}
});
// Make the dialog non-cancellable by clicking outside
builder.setCancelable(false);
AlertDialog dialog = builder.create();
dialog.show();
}
Yes, Thats what im doing
If you found my answer helpful, please mark it as a solution otherwise, let me know if you need more help.
But the topic will close after that
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.