Log in or register to post comments

Hiding Android buttons

September 26, 2012 - 12:32am #1

In my app i want to make an android button visible on placing camera over an active trackable.

I followed Dominoes and other samples and i am able to do some part of it.

I have added 2 functions in my java file. One to make a button added using overlay to be visible and other to make it visible.

So my code is if something like this below.

So  initally no button, when i move camera over stones button appears, if i move camera out of the trackable , the button remain which is not what i want

The button remains till i show it over chips image ie another active trackable.

But instead of that is it possible to make the button hide whenever i move camera out of stones. Can that be done. Please guide me

 

code :

 if (strcmp(trackable->getName(), "chips") == 0)
        {
   .....
    method = env->GetMethodID(javaClass, "deleteButton", "()V");
            env->CallVoidMethod(obj, method, js);
           
        }
        else if (strcmp(trackable->getName(), "stones") == 0)
        {
  .....
      
    (javaClass, "showButton", "()V");
            env->CallVoidMethod(obj, method, js);
   //showDeleteButton();
   }
 ...
        }
        else
        {
  jmethodID method = env->GetMethodID(javaClass, "deleteButton", "()V");
            env->CallVoidMethod(obj, method, "");
            textureIndex = 2;
        }

 

Hiding Android buttons

September 26, 2012 - 4:40am #2

I got my answer. Need to check if(state.getNumActiveTrackables() ==0 ) . This indicates no trackables are in the frame. Thank you

Log in or register to post comments