Log in or register to post comments

show message box using framemarket app

June 26, 2012 - 4:55pm #1

I'm new to programming on Android and I try to create an application using framemarket to only show a text box, I could help or guide me how to realize?

show message box using framemarket app

July 9, 2012 - 5:18pm #8



Anyone can help me with this?

show message box using framemarket app

July 2, 2012 - 3:12pm #7

Hello Peter


I understand the idea, but i don't know how to do that.

I've been trying some examples with buttons, and i've been reading about Alertidialog, this is an example of what i already tried:

rotected void onResume()



        // Create a new handler for the renderer thread to use

        // This is necessary as only the main thread can make changes to the UI

        ImageTargetsRenderer.mainActivityHandler = new Handler() {


            public void handleMessage(Message msg) {

            Context context = getApplicationContext();

            String text = (String) msg.obj;

            AlertDialog.Builder dialog = new AlertDialog.Builder(ImageTargets.this);


            dialog.setMessage("esta es una prueba");

            dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {  

              public void onClick(DialogInterface dialog, int id) {  







According to my understanding i need something like this but i can't understand how to make something like a function (?), to call it from the cpp fyle when the trackableid is zero.

Thanks in advance.



show message box using framemarket app

June 29, 2012 - 5:34pm #6


You need to reset the value of lastTrackableID I think when no trackables are found. So when number of trackables is 0, reset the trackable ID value. You'll also want to put in code here to remove your message from the screen. If you don't reset the value of TrackableID then the message will not display with you view the target, leave the target, and then view the target again. The Android documentation should have information about dismissing a dialog box.

Thank you,


show message box using framemarket app

June 29, 2012 - 4:25pm #5

Hello Peter


First of all, thanks and sorry that this again in another query. I followed your advice and I can show the dialog on the screen, but I have the problem that the dialogue is not removed, remains on the screen until I click back on my device.

Tried insert a while cycle in the file ImageTargets.cpp, but I realized I need some function to send close the dialog, but I can not visualize how is this function.

Could you please help me?

This is the code i wrote in ImageTargets:


Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv* env, jobject obj)


// Get the state from QCAR and mark the beginning of a rendering section

    QCAR::State state = QCAR::Renderer::getInstance().begin();

        // Explicitly render the Video Background


    // Did we find any trackables this frame?

    if (state.getNumActiveTrackables() == 0)


    lastTrackableId = -1;


while (state.getNumActiveTrackables()!=0){

for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++)


// Get the trackable:

const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);

// Compare this trackable's id to a globally stored id

// If this is a new trackable, find the displayMessage java method and

// call it with the trackable's name

 if (trackable->getId() != lastTrackableId) {

jstring js = env->NewStringUTF(trackable->getName());

jclass javaClass = env->GetObjectClass(obj);

jmethodID method = env->GetMethodID(javaClass, "displayMessage", "(Ljava/lang/String;)V");

env->CallVoidMethod(obj, method, js);

   lastTrackableId = trackable->getId();







I changed the While for an If, because the While was freezing the screen.



- Julio

show message box using framemarket app

June 29, 2012 - 9:20am #4

Hello silentem,

It sounds like you want to replace the code that shows the toast with code that displays a dialog. There are some great samples in the Android SDK showing how to display a dialog. Also the Android developer site has lots of information on how to do this. If you need help integrating the code in Vuforia please post your code and what issues you are having and I'll be happy to help.


show message box using framemarket app

June 28, 2012 - 4:59pm #3

Hi Peter


I'm newbie to programming on Android, i trying to show a dialog with buttons but a don't know how to make it, i already make de example with the toast.

According to my undestading would have to modify the code in onResume within ImageTarget.java, am i right?

Can you help me?


show message box using framemarket app

June 28, 2012 - 1:23pm #2


There are a number of forum topics on this. Please see this one for some sample code using ImageTargets. https://ar.qualcomm.at/content/changing-action-after-recognized-tracker

Thank you,


Log in or register to post comments