So, I have two operations. The main one is called the Main , and the child is called the Child . When the button is pressed in the main action, it calls the following code fragment:
Intent i = new Intent(Main.this, Child.class); Main.this.startActivity(i);
This opens up the activity of the child .
As soon as I call the finish line () or click the "Back" button in the child activity, and do not return to the main one, the application will simply close. Can you give me a hint where the problem might arise :(
PS By court and by mistake I found out that if you edit AndroidManifest.xml and add
android:theme="@android:style/Theme.Dialog"
in the childโs button declaration, and the finish () call behaves as expected: closes the child activity and focuses the main attention. The problem is that when I start typing EditText , the screen starts to flicker (rather, bizzare). Therefore, I cannot use it as a dialogue. My main activity is using a camera, so this can cause problems. Although, when a child activity starts, the onPause event fires and stops the camera until onResume is called.
Edit:
So I tried using startActivityForResult and added
Toast.makeText(this, "onPause", Toast.LENGTH_SHORT).show();
for onPause and a similar onResume method. When Child returns onResume , it does not start. I even redefined onActivityResult , and even that doesn't work. :( So weird ...
I think I found a problem, but I canโt solve it myself
When the Child operation is active, onStop and immediately after that onDestroy is called as part of the Main activity, But why?!?
java android android-activity android-manifest
Martin marinov
source share