"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

Show and hide a View

Hi

 

I'm working with de ImageTargets example, i want to show a View when trackable is detected, and hide the View when there's no trackables detected.

I already have the layout, and can show the View on screen, but i don't know how to hide the view when the trackable is no longer on camera.

Can someone please help me?

AlessandroB

Mon, 10/22/2012 - 19:50

Hi, a View (in Android) can be hidden just by calling view.setVisibility( VIEW.GONE );

does it answer your question? 

Hi

I've been investigating, the line i think is view.setVisibility(view.INVISIBLE), but i think i need to change the ImageTargets.cpp?

That's my question. 

I'm not shure if this is right.

Thanks in advance.

AlessandroB

Tue, 10/23/2012 - 07:13

Hi, in ImageTargets.cpp you will find the code that checks if there are any active trackables in the current view (see the "for loop" with "state.getNumActiveTrackables()" in the _renderFrame method)

Hi again Alessandro

 

Thanks for the response

I think I understand a little the idea but I have not entirely clear. I'll keep investigating and reading a little more.

AlessandroB

Tue, 10/23/2012 - 15:16

Hi, concerning the link that you cannot acess, I'm copying the text here below:

 

Hi Alessandro

Actually I had found this information, this is how I show in this moment the View on screen.

My problem it's i don't know how i need to program the JNI to show and hide the View when trackable it's detected.

AlessandroB

Fri, 10/26/2012 - 20:49

You can choose how many classes to create in Java and how you spread the code through the application (so there are many ways of achieveing the same result); 

the only couple of RULES to keep in mind when working with JNI are these:

AlessandroB

Wed, 10/31/2012 - 16:00

Hi, happy to hear I was helpful :-)

About your code: it looks all right, but not sure what you mean by doing "id = 1" or "id = 2" (it's not clear how the id variable is used in your code) .... also, what is your doubt in particular?

 

 

Hi

That's a temporary code to get an id to send it to a data base, but works fine.

My doubt it's on the part of the first "if".

AlessandroB

Thu, 11/01/2012 - 21:14

OK, the problem could likely be that you only send a message to the Handler for each trackable detected (from the _renderFrame() code in ImageTargets.cpp), but maybe you also need to say that a certain Trackable (e.g.

How do i make the ImageTracker have a transparent shader so that i can have stuff coming up from below the 'ground'

I tried to change to Ulint /trans shader but it swaps it back at runtime.

AlessandroB

Wed, 11/28/2012 - 16:29

Hi Warren, is this related to Android or to Unity ?

if that's about Unity, please post it in the Unity section of the Forum.