Log in or register to post comments

Launch ImageTarget from my own application

September 24, 2011 - 4:27am #1

Hi, this is my first message in this board :)

I've setup my workspace and ImageTargets go well :)... Now I want to launch ImageTargets from a button in my application....I've searched in this board and i've found this:

and this

but...I don't understand HOW can i do that :o what must I modify?

In a few words I want to merge my project with ImageTarget....an idea is to switch view?

help :D

thanks a lot

Re: Launch ImageTarget from my own application

September 25, 2011 - 7:44am #2

First, when you copy the ImageTargets code into your application you'll need to watch the package names. You can either leave the ImageTargets code in the com.qualcomm.QCARSamples.ImageTargets package or bring it into your application's package. If you change the package name, you have to update all the functions in ImageTargets.cpp to use your package name instead of com_qualcomm_QCARSamples_ImageTargets.

ImageTargets has its own Android Activity, so you'll start that from your application's activity using the code snippets you've seen before:

Intent myIntent = new Intent(this, ImageTargets.class);

Put that in a button handler, for instance. The "this" refers to an application Context, if you put this code in your main activity it should just work.

For more on starting activities: http://developer.android.com/reference/android/app/Activity.html#StartingActivities

Finally, you need to modify the AndroidManifest file. You'll want to merge the one from your project with the one from the ImageTargets sample. Make sure your activity is the main one (it should have the MAIN action and LAUNCHER category, remove these from the ImageTargets activity). Watch the package names here again, you may need to fully define the ImageTargets class (with its package prefix) if it's in a different package than your main activity.

Let us know if you get stuck on any particular point. If it's crashing at runtime be sure to look at the log for errors (DDMS perspective in Eclipse).

- Kim

Log in or register to post comments