Log in or register to post comments

Placing the ImageTargets sample in a fragment

January 25, 2012 - 6:06am #1

Hey,
I'm trying to place the entire sample in a fragment, and keep getting the full screen mode, I made a new class that is the main class that extends FragmentActivity then made the ImageTargets activity to extend from fragment, made an xml with half screen size for the ImageTargets, and for the ImageTargets kept the same xml, now when i open it i keep getting full screen, not sure how to make the opengl screen to fit the size of the one that i need, any suggestions ? ?
Thanks in advance for any help !

Placing the ImageTargets sample in a fragment

May 8, 2018 - 10:30am #7

Below Comment adds a new constructor in a fragement, which gives an error in my application. I am trying to set up the video playback sample in a fragement for hours now. With no success. Can anyone please point me into the right direction or place to look.

Thanks and greetings, Sven

 

 

Placing the ImageTargets sample in a fragment

November 29, 2013 - 6:42am #6

My previous post already contains all the instructions and code snippets that I have used.

 

Placing the ImageTargets sample in a fragment

November 29, 2013 - 5:09am #5

Hi Alessandro,

With respect to using Fragments, can you post the code for the Image Targets sample that you were able to Integrate. If you have already added it in FAQ or any other post can you give me the link. I was unable to get more info on this.

 

With Regards,

MSL

Placing the ImageTargets sample in a fragment

October 8, 2013 - 1:39pm #4

You should be able to integrate Vuforia with Fragments (I was able to do that in ImageTargets sample);

for example, if you want to put the GLView (used by Vuforia) into a Fragment, you could do the following:

- define a Fragment class which returns the GLView of the sample in the onCreateView() method, as shown in this example:

public static class MyFragment extends Fragment {
    	
    	private final GLSurfaceView mFragGLView;
    	
    	public MyFragment(GLSurfaceView glView) {
    		super();
    		mFragGLView = glView;
    	}
    	
    	@Override
    	public View onCreateView(LayoutInflater inflater, ViewGroup container,
    	        Bundle savedInstanceState) {
    		return mFragGLView;
    	}
    	
    	@Override
    	public void onPause() {
    		super.onPause();
    		mFragGLView.onPause();
    	}
    	
    	@Override
    	public void onResume() {
    		super.onResume();
    		mFragGLView.onResume();
    	}
    	
    }

- then replace the code addContentView(mGLView, ...)    with the following code, which adds the Fragment above:

FragmentManager fragManager = getFragmentManager();
                FragmentTransaction fragTransaction = fragManager.beginTransaction();
                fragTransaction.add(android.R.id.content, new MyFragment(mGlView));
                fragTransaction.commit();

As far as I tested, this should work.

Of course you can setup more complex Fragment-based setups, by extending / adjusting the basic sample above.

 

Placing the ImageTargets sample in a fragment

October 8, 2013 - 9:14am #3

Any news on this one? I am also interested in placing an AR view within a fragment. Woud be very happy if anybody could point me to some source code.

Re: Placing the ImageTargets sample in a fragment

January 26, 2012 - 8:10pm #2

Unfortunately Fragments are not currently supported. This is something we will look into for a future release.

- Kim

Log in or register to post comments