Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

Processing-Android mode : AlertDialog, How do you code it? Help.

$
0
0

How do you code it? Help. Please help me.

//Import required classes
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.AlertDialog.Builder.*;
import android.app.AlertDialog.*;
import android.content.DialogInterface;


void setup() {

//    activity=(Activity) this.context;
//    activity.runOnUiThread(Runnable r) ;

//Create the AlertDialog
AlertDialog alertDialog = new AlertDialog.Builder(this).create();
//Set the title
alertDialog.setTitle("Alert");
//Set the message
alertDialog.setMessage("This is an AlertDialog!");
//Add the OK button
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface dialog, int which) {
    //The OK button has been clicked
 }});
//Display the AlertDialog
alertDialog.show();
}

void draw() {
}

Error message : 4. ERROR in C:\Users\Administrator\AppData\Local\Temp\android7595228112886938022sketch\src\processing\test\android_test\android_test.java (at line 43) AlertDialog alertDialog = new AlertDialog.Builder(this).create(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The constructor AlertDialog.Builder(android_test) is undefined BUILD FAILED C:\Users\ADMINI~1\AppData\Local\Temp\android7595228112886938022sketch\build.xml:15: The following error occurred while executing this line: C:\Users\ADMINI~1\AppData\Local\Temp\android7595228112886938022sketch\build.xml:28: Compile failed; see the compiler error output for details.

Total time: 1 second

error


Viewing all articles
Browse latest Browse all 941

Trending Articles