[SOLVED] Android initial variable from Activity and exit to Activity

Hi guys… Is there any chance to start my app from android activity with initial variable, say “name” and go back to Activity on demand ? How to? Thanks

Ok… then how to properly to place my app as a fragment on activity template. I Am expecting it should be runned as a thread but I it still not working :-/

Im almost sure its not enough information “it still not working”. I just know its Thread related.

So please provide more information. :slight_smile:

package com.jme.Example;
import android.app.Activity;
import android.app.FragmentManager;
import android.os.Bundle;
import com.jme.Citadel.Cytadela;
import com.jme3.app.AndroidHarnessFragment;

public class GameActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_game);

    FragmentManager fragmentManager = getFragmentManager();
    AndroidHarnessFragment jmeFragment = (AndroidHarnessFragment) fragmentManager.findFragmentById(R.id.app_fragment);

    GameActivity.this.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Cytadela app = new Cytadela();
        }
    });    }}

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.jme.Example, PID: 23449
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jme.Example/com.jme.Example.GameActivity}: android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2957)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class fragment…

i belive android developers would also like to see XML file to help you. then i hope it will be enough information.

im not android developer, but as i see it can be caused by multiple things (wrong name in xml, error in class). you sure everything is correct like “R.id.app_fragment”?

btw. anyway if this is strict Android error, you can always search help on Android forums, its not JME issue as i see.

As other mentioned I as well can not see anything jMonkeyEngine related in your posts, so you probably in the wrong forum…

Not quite wrong forum. I solved problem. there was no jmeFragment extended by AndroidHarness

2 Likes