Android Question how to run java activty from class

mzsoft

Member
hi
i write this class .

B4X:
#If JAVA
import org.godotengine.godot.GodotActivity;
import android.os.Bundle;

public class GodotApp extends GodotActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        
        super.onCreate(savedInstanceState);
    }
}
#End If

and if activity create

B4X:
Private NativeMe As JavaObject
NativeMe.InitializeNewInstance(Application.PackageName & ".main$GodotApp",Array(Null))

and manifest

B4X:
AddApplicationText(
    <activity
        android:name="b4a.example.godot.main$GodotApp"
        android:exported='true'
        android:screenOrientation='fullUser'
        android:configChanges='orientation|screenSize|smallestScreenSize|screenLayout'
         >
<intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
          
          </activity>
)

but not work.
how can i start this activity.
 

mzsoft

Member
i also test intent.
B4X:
#AdditionalJar: godot-4.3.0.stable64.aar

B4X:
Dim intent As Intent
    intent.Initialize(intent.ACTION_MAIN, "")
    intent.SetComponent("org.godotengine.godot/.GodotActivity")
    StartActivity(intent)

but error show.
B4X:
android.content.ActivityNotFoundException: Unable to find explicit activity class {org.godotengine.godot/org.godotengine.godot.GodotActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>?
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2249)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1878)
    at android.app.Activity.startActivityForResult(Activity.java:5760)
    at android.app.Activity.startActivityForResult(Activity.java:5718)
    at android.app.Activity.startActivity(Activity.java:6216)
    at android.app.Activity.startActivity(Activity.java:6183)
    at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:857)
    at b4a.example.godot.main._startgodotactivity(main.java:476)
    at b4a.example.godot.main._activity_create(main.java:350)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
    at b4a.example.godot.main.afterFirstLayout(main.java:105)
    at b4a.example.godot.main.access$000(main.java:17)
    at b4a.example.godot.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at android.app.ActivityThread.main(ActivityThread.java:8919)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…