avi-otterai / andar

Automatically exported from code.google.com/p/andar
0 stars 0 forks source link

AlertDialog when detecting marker #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I want that when the camera detects the marker, an AlertDialog with a button 
will be shown.

I've made the AlertDialog but when I do the .show() method, the application 
dies. I've put this method in the draw() function of the CustomObject, but 
creating another class.

Can anybody help me?

Here I paste the code.

In the CustomActivity.java I do:

CustomBuilder customBuilder = new 
CustomBuilder("androidMarker","androidMarker",80.0, new 
double[]{0,0},this.getApplicationContext(),"android!");

artoolkit.registerARObject(customBuilder);

and in the CustmBuilder.java (that is similir to CustomObject.java) I do:

public Builder alertDialog;
public CustomBuilder(String name, String patternName,
double markerWidth, double[] markerCenter, Context context,    
CharSequence text) {
        super(name, patternName, markerWidth, markerCenter);

        alertDialog = new AlertDialog.Builder(context);
        alertDialog.setTitle("Information");
        alertDialog.setMessage("bla bla bla");
        alertDialog.setNeutralButton( "OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                 return;
            }
        });
    }

    public final void draw(GL10 gl) {
        alertDialog.show(); //The problem is here
    }

Can anybody help me with this?

Original issue reported on code.google.com by bmp.barb...@gmail.com on 23 Sep 2011 at 9:57

GoogleCodeExporter commented 9 years ago
 the same problem at me, all period i'm trying to understand why.. %) pls experts help 

Original comment by victor.g...@gmail.com on 2 Feb 2012 at 3:02