"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

PROBLEMA

 

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 

DavidBeard

Tue, 07/10/2012 - 00:11

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.

malilla01

Tue, 07/10/2012 - 16:55

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.

 

malilla01

Wed, 07/11/2012 - 23:29

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

DavidBeard

Thu, 07/12/2012 - 00:56

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?

 

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.

DavidBeard

Thu, 07/12/2012 - 20:40

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 )

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

Hi David

Any suggestions about this?

 

Thanks in advance

DavidBeard

Mon, 07/16/2012 - 18:01

Does the text disappear if you send a blank message (i.e. "" ).

DavidBeard

Fri, 07/27/2012 - 17:23

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.

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?

DavidBeard

Fri, 07/27/2012 - 17:37

Change 'overlay' to the name of your view.

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.

ryo020288

Fri, 11/09/2012 - 07:05

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

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.