# Sketch exported to Android Studio, cannot use in Multi-Fragment Scenario

**URL:** <https://discourse.processing.org/t/sketch-exported-to-android-studio-cannot-use-in-multi-fragment-scenario/34699>\
**Category:** Processing for Android\
**Created:** [January 17, 2022, 10:37pm UTC](https://discourse.processing.org/t/sketch-exported-to-android-studio-cannot-use-in-multi-fragment-scenario/34699 "2022-01-17T22:37:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![foxfire999](https://avatars.discourse-cdn.com/v4/letter/f/4af34b/32.png) [@foxfire999](https://discourse.processing.org/u/foxfire999)\
**Post date:** [January 17, 2022, 10:37pm UTC](https://discourse.processing.org/t/sketch-exported-to-android-studio-cannot-use-in-multi-fragment-scenario/34699/1 "2022-01-17T22:37:14Z")

</div>

I have successfully exported a sketch to A.S., when run as a single fragment in a single activity it works fine,

When I want to insert a custom fragment alongside it (2 separate FrameLayouts); the custom fragment’s createView() fails

sketch = new MySketch(); # Regular Processing sketch  
fragment = new PFragment(sketch); # PFragment  
frame = findViewById(R.id.the\_frame); # FrameLayout 1

fragment2 = new ARHelperFragment(); # A custom fragment  
frame2 = findViewById(R.id.the\_frame2); # FrameLayout 2

getSupportFragmentManager().beginTransaction() # works fine if other closed.  
.replace(R.id.the\_frame, new ARHelperFragment())  
.commit();

getSupportFragmentManager().beginTransaction() # works fine if other closed.  
.replace(R.id.the\_frame2, fragment2)  
.commit();

the issue is, displaying a custom fragment after a processing fragment is called.

 ![Screen Shot 2022-01-17 at 10.34.10 PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/ae372d0f84564a7b11f85f700b6002cc430bc53e.png)

if the custom fragment is called BEFORE processing fragment, no error occurs, processing fragment simply takes up the whole space.

Either way I’m very stuck with displaying a PFragment alongside a custom Fragment. Any ideas?..
