# Custom Activity

**URL:** <https://forums.unrealengine.com/t/custom-activity/18960>\
**Category:** Mobile\
**Tags:** unreal-engine, Android\
**Created:** [January 15, 2015, 2:06pm UTC](https://forums.unrealengine.com/t/custom-activity/18960 "2015-01-15T14:06:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_e281dc471](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e281dc471](https://forums.unrealengine.com/u/anonymous_user_e281dc471)\
**Post date:** [January 15, 2015, 2:06pm UTC](https://forums.unrealengine.com/t/custom-activity/18960/1 "2015-01-15T14:06:27Z")

</div>

When I try add my custom activity I get this error:

```auto

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.epicgames.TheTaleOfThreeMobile/com.epicgames.ue4.GameActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.epicgames.TheTaleOfThreeMobile/com.epicgames.ue4.TestActivity}; have you declared this activity in your AndroidManifest.xml?

```

But I declared this activity in AndroidManifest.xml:

```auto

    <activity android:name="com.epicgames.ue4.TestActivity"
                android:label="@string/app_name"
                android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                android:launchMode="singleTask"
                android:screenOrientation="landscape"
                android:debuggable="true"
                android:configChanges="orientation|keyboardHidden">
                <meta-data android:name="android.app.lib_name" android:value="UE4"/>
            </activity>

```

Anyone know how to do this?

---

<div class="post-metadata">

**Author:** ![Dredok](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dredok](https://forums.unrealengine.com/u/Dredok)\
**Post date:** [January 16, 2015, 5:18pm UTC](https://forums.unrealengine.com/t/custom-activity/18960/2 "2015-01-16T17:18:19Z")

</div>

Where are you storing this TestActivity.java ?

AFAIK it should be in (ENGINEDIR)\Build\Android\Java\src\com\epicgames\ue4\ (i don’t have had a deep look at unrealbuildtool, but you could store it here until someone expert will clarify this)

What I’m doing is modifying directly the engine GameActivity class (located there).

---

<div class="post-metadata">

**Author:** ![Kayhan\_Ygh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kayhan\_Ygh](https://forums.unrealengine.com/u/Kayhan_Ygh)\
**Post date:** [September 10, 2016, 8:43am UTC](https://forums.unrealengine.com/t/custom-activity/18960/3 "2016-09-10T08:43:41Z")

</div>

Hey guys!

I wanted to start an activity by pressing a UMG button? How can I implement this?

Thanks!

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [September 13, 2016, 12:37am UTC](https://forums.unrealengine.com/t/custom-activity/18960/4 "2016-09-13T00:37:14Z")

</div>

You will need to write some C++ code to expose a Blueprint function to call Java using JNI.

---

<div class="post-metadata">

**Author:** ![Kayhan\_Ygh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kayhan\_Ygh](https://forums.unrealengine.com/u/Kayhan_Ygh)\
**Post date:** [September 13, 2016, 5:15pm UTC](https://forums.unrealengine.com/t/custom-activity/18960/5 "2016-09-13T17:15:28Z")

</div>

Hi Chris  
Thanks for your replay!  
Where should I write my android activity( java functions ) and how to access them in my project?

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [September 13, 2016, 9:25pm UTC](https://forums.unrealengine.com/t/custom-activity/18960/6 "2016-09-13T21:25:37Z")

</div>

You can write a plugin and register a UPL file to copy the java source to compile. Any hookup you need to the GameActivity can also be done in this file. Look at Gear VR or Google VR plugins for examples.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7d8f073a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7d8f073a](https://forums.unrealengine.com/u/anonymous_user_7d8f073a)\
**Post date:** [March 22, 2017, 2:17am UTC](https://forums.unrealengine.com/t/custom-activity/18960/7 "2017-03-22T02:17:26Z")

</div>

If you want to register your activity in AndroidManifest.xml, You can use ManifestApplicationAdditions.txt File.  
In the path Build -\> Android, Add the ManifestApplicationAdditions.txt File.  
And, write the contents like this \<activity android:name=“com.companyname.activity name” /\>.

---

<div class="post-metadata">

**Author:** ![Fe\_Games\_Studio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fe\_Games\_Studio](https://forums.unrealengine.com/u/Fe_Games_Studio)\
**Post date:** [September 15, 2023, 10:07am UTC](https://forums.unrealengine.com/t/custom-activity/18960/8 "2023-09-15T10:07:28Z")

</div>

Did you manage to add and launch the activity?  
If so, could you send me your XML or tell me how you did it?  
I have a java file in which there is an activity.  
and I need it to start.  
I have already made code that would launch methods from XML, but I still have a problem with launching the activity
