Log in or register to post comments

Try this but error please help

October 30, 2012 - 1:12am #18

i try to make app starting from imagetarget. now i try to show some text like this

http://gavinmhackeling.com/blog/2012/03/ar-gallery-guide-for-android/

 

but error in show a textview and have many error in this guide..anyone can help me

Try this but error please help

October 30, 2012 - 1:45pm #17

Hi, what kind of errors do you get ?

can you explain the relevant changes that you are trying to do with respect to the ImageTargets sample ?

 

Try this but error please help

November 7, 2012 - 4:38am #16

i used this part in render frame :

 for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++)
    {
        // Get the trackable:
        const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);
        QCAR::Matrix44F modelViewMatrix =
            QCAR::Tool::convertPose2GLMatrix(trackable->getPose());       

// Get a reference to the displayMessage java method and pass it the name of the image that was recognized
        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();
        }
}

this is not error

 

next, i used this code in java part but not error to

    public void displayMessage(String text)
    {
        DebugLog.LOGD("in DisplayMessage");
        // We use a handler because this thread cannot change the UI
        Message message = new Message();
        message.obj = text;
        mainActivityHandler.sendMessage(message);       
    }

 

in this part in imagetaget.cpp have many error like context, clear button, fulltext,toggle button, overlay, add content view, etc.

     protected void onResume()
    {
        DebugLog.LOGD("ImageTargets::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 UI
        ImageTargetsRenderer.mainActivityHandler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                Context context = getApplicationContext();
                String text = (String) msg.obj;
                DebugLog.LOGD("main activity received: " + text);

                // Set the layout's text. this is not the best way to do this but ok
                if(text.equals("w")) {
                }
                else if(text.equals("w1")){
                    fullText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sed laoreet mauris. Integer et ullamcorper tortor. Mauris interdum orci pulvinar eros consequat interdum.";       
                    titleText = "Insomnia";
                    subtitleText = "Jeff Wall";
                }
                else if(text.equals("w3")){
                    fullText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sed laoreet mauris. Integer et ullamcorper tortor. Mauris interdum orci pulvinar eros consequat interdum.";       
                    titleText = "Man with a Rifle";
                    subtitleText = "Jeff Wall";
                }
                else if(text.equals("w4")) {
                    fullText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sed laoreet mauris. Integer et ullamcorper tortor. Mauris interdum orci pulvinar eros consequat interdum.";
                    titleText = "Siphoning Fuel";
                    subtitleText = "Jeff Wall";
                }
                else if(text.equals("w8")){
                    fullText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sed laoreet mauris. Integer et ullamcorper tortor. Mauris interdum orci pulvinar eros consequat interdum.";
                    titleText = "The Destroyed Room";
                    subtitleText = "Jeff Wall";               
                }
                else if(text.equals("w10")) {
                    titleText = "Ivan Sayers, costume historian, lectures at the University Women's Club, Vancouver, 7 December 2009";
                    subtitleText = "Jeff Wall";       
                    fullText = "no text written";   
                }

                if(clearButton != null){
                    ((ToggleButton) clearButton).setChecked(false);
                    textView.setVisibility(View.VISIBLE);
                    titleView.setVisibility(View.VISIBLE);
                    subtitleView.setVisibility(View.VISIBLE);
                }           

                // Create the overlay layout if it does not exist. there must be a better way to do this
                if(!overlayCreated){
                    DebugLog.LOGD("creating overlay");
                    // Inflate the overlayView layout
                    overlayView = View.inflate(context, R.layout.interface_overlay, null);
                    addContentView(overlayView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

                    clearButton = (ToggleButton) overlayView.findViewById(R.id.clear_button);
                    clearButton.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                            if (((ToggleButton) v).isChecked()) {
                                textView.setVisibility(View.INVISIBLE);
                                titleView.setVisibility(View.INVISIBLE);
                                subtitleView.setVisibility(View.INVISIBLE);
                            } else {
                                textView.setVisibility(View.VISIBLE);
                                titleView.setVisibility(View.VISIBLE);
                                subtitleView.setVisibility(View.VISIBLE);
                            }
                        }
                    });               

                    overlayCreated = true;
                }
                textView = (TextView) overlayView.findViewById(R.id.textview);
                textView.setText(fullText);
                titleView = (TextView) overlayView.findViewById(R.id.titleview);
                titleView.setText(titleText);
                subtitleView = (TextView) overlayView.findViewById(R.id.subtitleview);
                subtitleView.setText(subtitleText);
            }

 

can u give me some solution or tutorial..?thnks

Try this but error please help

November 7, 2012 - 4:44am #15

You say that the "protected onResume()" method (where you get all errors) is in "ImageTargets.cpp";

this should be in ImageTargets.java; can you confirm that ?

 

 

Try this but error please help

November 7, 2012 - 7:27am #14

yes in imagetarget.java in on resume method, i can't create overlay n show the text or addcontent...

Try this but error please help

November 7, 2012 - 7:38am #13

Hi, can you be a little bit more precise on the specific errors you get?

do you get runtime errors such as NullPointer exceptions or others ?

Would be great if you could Log the error messages and copy-paste some of them here. You can Log using adb logcat or DDMS in Eclipse.

The error messages logged would really help.

Try this but error please help

November 7, 2012 - 8:16am #12

Description    Resource    Path    Location    Type
Message cannot be resolved to a type    ImageTargetsRenderer.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 33    Java Problem ( public static Handler mainActivityHandler;)
Handler cannot be resolved to a type    ImageTargetsRenderer.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 35    Java Problem (Message message = new Message(); message.obj = text;
Handler cannot be resolved to a type    ImageTargetsRenderer.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 28    Java Problem
Message cannot be resolved to a type    ImageTargetsRenderer.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 33    Java Problem

and in this imagetarget.java

Description    Resource    Path    Location    Type
subtitleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 425    Java Problem
id cannot be resolved or is not a field    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 422    Java Problem
titleView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 423    Java Problem
titleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 423    Java Problem
subtitleView cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 424    Java Problem
TextView cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 424    Java Problem
overlayView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 424    Java Problem
id cannot be resolved or is not a field    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 424    Java Problem
subtitleView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 425    Java Problem
Message cannot be resolved to a type    ImageTargetsRenderer.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 33    Java Problem
TextView cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 420    Java Problem
Handler cannot be resolved to a type    ImageTargetsRenderer.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 35    Java Problem
overlayView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 420    Java Problem
id cannot be resolved or is not a field    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 420    Java Problem
Handler cannot be resolved to a type    ImageTargetsRenderer.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 28    Java Problem
Message cannot be resolved to a type    ImageTargetsRenderer.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 33    Java Problem
textView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 421    Java Problem
fullText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 421    Java Problem
titleView cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 422    Java Problem
TextView cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 422    Java Problem
overlayView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 422    Java Problem
titleView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 408    Java Problem
textView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 407    Java Problem
textView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 411    Java Problem
subtitleView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 409    Java Problem
subtitleView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 413    Java Problem
titleView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 412    Java Problem
textView cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 420    Java Problem
overlayCreated cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 418    Java Problem
clearButton cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 403    Java Problem
overlayView cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 401    Java Problem
overlayView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 403    Java Problem
ToggleButton cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 403    Java Problem
clearButton cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 404    Java Problem
id cannot be resolved or is not a field    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 403    Java Problem
ToggleButton cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 406    Java Problem
ToggleButton cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 406    Java Problem
textView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 391    Java Problem
titleView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 392    Java Problem
ToggleButton cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 390    Java Problem
clearButton cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 390    Java Problem
overlayView cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 400    Java Problem
interface_overlay cannot be resolved or is not a field    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 400    Java Problem
subtitleView cannot be resolved    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 393    Java Problem
overlayCreated cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 397    Java Problem
subtitleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 381    Java Problem
titleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 384    Java Problem
fullText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 379    Java Problem
titleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 380    Java Problem
clearButton cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 389    Java Problem
ToggleButton cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 390    Java Problem
subtitleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 385    Java Problem
fullText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 386    Java Problem
titleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 370    Java Problem
fullText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 369    Java Problem
subtitleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 366    Java Problem
titleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 365    Java Problem
subtitleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 376    Java Problem
titleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 375    Java Problem
fullText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 374    Java Problem
subtitleText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 371    Java Problem
fullText cannot be resolved to a variable    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 364    Java Problem
Context cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 356    Java Problem
Message cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 355    Java Problem
Handler cannot be resolved to a type    ImageTargets.java    /com.qualcomm.QCARSamples.ImageTargets.ImageTargets/src/com/qualcomm/QCARSamples/ImageTargets    line 353    Java Problem

Try this but error please help

November 7, 2012 - 9:28am #11

Hi, thanks for the log;

those error messages mean that those variables (like textView, subtitleView, clearButton, etc.) have not been defined in any valid scope (or maybe not defined at all in Imagetargets.java);

have you declared those somewhere in your code ?

 

Try this but error please help

November 7, 2012 - 10:02am #10

ooo...i see...i'm not declared it.thnks for your response. i will try it.

Try this but error please help

November 7, 2012 - 11:40pm #9

You're welcome.

Try this but error please help

November 8, 2012 - 9:12am #8

can u help me make some example like this for me..i can't make it.have many problems n error

Try this but error please help

November 8, 2012 - 9:22am #7

I cannot provide a full sample to do what you want, but I can suggest to check this thread:

https://ar.qualcomm.at/content/android-how-can-i-update-my-ui-response-tracking-events

(maybe you already did),

and then try to implement your application gradually, i.e. first try to display a simple Toast message with some text (like explained in the thread above) when you detect a trackable (similarly to what shown in the video at the beginning of your post),

then by adding a simple layout with a simple TextView, and so on.

I think the code you were trying is a good start, but try to simplify it to a minimum and gradually move on...

 

 

Try this but error please help

November 8, 2012 - 9:50am #6

i can't show the button and the text can't show...i dont know what is my problem....can u help me?

Try this but error please help

November 8, 2012 - 9:54am #5

yes, i did n try that.i can show a toast n text...but i want to show a text like a dialog box and if we click the button show, it show the detail and if click again it's only to show the tittle

Try this but error please help

November 9, 2012 - 5:38am #4

Hi, a good place where to get the code to do what you intend (overlay of widgets on the view) is the Dominoes samples, in particular check the code in these two classes:

Dominoes.java:

addContentView(mGUIManager.getOverlayView(), new LayoutParams(

                                            LayoutParams.FILL_PARENT,

                                            LayoutParams.FILL_PARENT));

GUIManager.java:

public void initButtons() { ... } and related code

 

Also, check in the res/layout folder of the sample, where you find a simple overlay_layout with a couple of buttons, that's a very good start for your case.

 

Try this but error please help

November 9, 2012 - 7:03am #3

yes. I try it, i copy the guimanager.java and the interface_overlay.xml and tes it but the code having a many problems and error.can u give me sample full code using imagetarget...i'm so confused it....i can't make a view and make a button android.thanks

Try this but error please help

November 9, 2012 - 12:57pm #2

the project is succes, but when i run the program, the button can show but the text can't show.if i click the button, the apllication crash.any solution?

 

Try this but error please help

November 11, 2012 - 5:26am #1

I see you posted the continuation of this in this new thread:

https://ar.qualcomm.at/content/error-close-application-or-press-back-button

Let's continue on that thread then.

 

Log in or register to post comments