Hello,
how can I have in my Java libray Show an alert box (MsgBox)? The following code works for an Eclipse Android project properly.
The bug is probably the "Builder":
The builder needs according to SDK a reference to the Activity. I get this under a android project without problems. If I use extends embed the Activity class, I always get a "NullPointerExceptiion". Thank you for your help in advance.
best regards
Amalkotey
how can I have in my Java libray Show an alert box (MsgBox)? The following code works for an Eclipse Android project properly.
B4X:
public int OK_MessageBox(String strMessage){
AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
alertbox.setMessage(strMessage);
alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
// Click
}
});
alertbox.show();
return 0;
}
The bug is probably the "Builder":
B4X:
new AlertDialog.Builder(this);
The builder needs according to SDK a reference to the Activity. I get this under a android project without problems. If I use extends embed the Activity class, I always get a "NullPointerExceptiion". Thank you for your help in advance.
best regards
Amalkotey