i am new programming in android and I have a problem with the application, I'm developing not know if I can help
the problem is how could I create a function that performs dismiss when trackable not be detected.
the code is this
[CODE]protected void onResume()
{super.onResume();// Create a new handler for the renderer thread to use// This is necessary as only the main thread can make changes to the UIImageTargetsRenderer.mainActivityHandler = new Handler() {@Overridepublic void handleMessage(Message msg) {Context context = getApplicationContext();String text = (String) msg.obj;AlertDialog.Builder dialog = new AlertDialog.Builder(ImageTargets.this); dialog.setTitle(text);dialog.setMessage("esta es una prueba");dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); }});dialog.show();}@Overridepublic void Dismiss(DialogInterface dialog, int id){dialog.dismiss();}};}[/CODE]I hope you can help me, thanks
PROBLEMA
So you want to allow the Tracker to search for a Trackable for a given interval and then dismiss the dialog if no Trackable is found?
If so, take a look at how the splash screen handler is implemented in ImageTargets.java. This is doing something similar..
e.g.
PROBLEMA
what you want to do is create an application that displays box dialogs and they show a specific information of an object, the box dialog should aparaser when detecting the label and desapareser when not detect the label.
PROBLEMA
DavidBeard thanks for the help, I have an idea of how the code, but I have a question.
Does the code only works for 3D objects? that I am using only Handle dialog
I had commented that used dismiss to hide the Handle dialog, but do not know how?
I hope you can help me
PROBLEMA
Let me see if I can provide you with a simple example of how to present, and remove, a Java UI View in response to Tracking states. We have some examples of this.
What is your button doing? Is it going to call any methods in C++ via JNI?
PROBLEMA
Hi again David
First of all, thank you for the help.
malilla01 and i are a team for a university project, let me explain you the idea we have.
PROBLEMA
If you have the dialog with button as a View, then you can set the visibility of that view to hide the dialog (see: setVisibility() @ http://developer.android.com/reference/android/view/View.html )
PROBLEMA
Hi David, i think it's better if i show you the actuall code, at this time, we can show the dialog when detecth the trackable, but the dialog stays on screen until we press de back button device:
[quote=ImageTarget.cpp]
int lastTrackableId=-1;
JNIEXPORT void JNICALL
PROBLEMA
Hi David
Any suggestions about this?
Thanks in advance
PROBLEMA
Does the text disappear if you send a blank message (i.e. "" ).
PROBLEMA
Hi David
PROBLEMA
You need to define the View in XML and place it in /res/layout for that code to work. Try creating a new Android Layout XML file in the layout folder. Name this 'overlay', and you can use the Eclipse GUI editor to design your dialog.
PROBLEMA
I have a doubt, i need 2 Views?, because i already added a View named "dialog" (dialog.xml), i need a second view?, or i need to change "overlay" for the name of my view?
PROBLEMA
Change 'overlay' to the name of your view.
PROBLEMA
Ok, thanks, that works.
The view is launched at the beginning but crashes and close the app, i'm gonna check to make the changes to launch the view when trackable is detected.
PROBLEMA
can u post ur code where i must change the code in imagetarget?i want to show text with dialog but i can't make button and view and how to call the function.thnks
PROBLEMA
Hello,
I've had the same problem myself.
Thus far, I have managed to show a View's layout, in front of the camera, but I want it to appear only after the trackable is detected.