Hi stack overflow community
I am developing an app for android. There I have to programm that when the backbutton is pressed, the app is send to the background.
I have done this with navigator.app.exitApp(). But I have found out that I get a second instance of the app when I start it new after pressed backbutton.
So I searched and now I want to overwrite the manifest.xml (android:launchMode="singleTask" instead of singleTop. But everytime when I enter cordova run android to put the app on my phone, the manifest.xml will be overwritten (again singleTop instead of the singleTask which I want.
How I can resolve this overwriting? Is it possible to resolve?
I've heard it is/was a bug of cordova? Have they corrected it?
https://issues.apache.org/jira/browse/CB-4911
Ok. What I did so far?
With Notepadd++ I opened the manifest.xml and overwrite the android:launchMode. Then I saved the file and opened the CLI in which I build android or run android.
But everytime these commands have overwritten the manifest.xml file.
Is there another way to modify the file manifest.xml without overwriting?
Thanks for your help.
Instead of using navigator.app.exitApp() you can use moveTaskToBack() but I'm not sure if it exists in cordova.
Also I think you set the wrong parameters because you have to set launchMode instead of label.
android:label="Name of the current activity"
android:launchMode="singleTop"
Hope it helps
Related
I made a simple app for android and it works fine, however when I open an activity with adb the emulator displays a complete with dialogue: Complete action using __.
Does anyone know how to fix this?
It's just asking you how you want to run your API. Just select API Demos and "Always". It won't ask you again.
The problem was that because I moved the activity classes to another package, the old package info remained in gradle.build and in the android manifest.
Adb did not say that such an activity does not exist because I had a space in between the package name and activity name and it started some other application apparently.
there are a lot of questions around this, however I was not able to solve.
My app shouldnt restart when the device is put into a specific car cradle. I just want to ignore it
I tried changing manifest
+
What do I need to code if I would like to handle the Configuration Change by myself?
How would my onConfigurationChanged method look like to just ignore the uiMode change and not restarting the app?
Thanks
I had the same problem.
Here's the fix:
Modify your AndroidManifest.xml to include uiMode in the android:configChanges element.
After that your app will handle uiMode-changes all by itself and doesn't restart anymore.
Greeting,
Chris
here is the problem. I'm new with android so i was just designing a simple form with some textfields and button, nothing complicated, and it runs perfectly!
Nevertheless when i add another class in order to work with SQLite database, it doesn't run, and shows the following message: "UNFORTUNATELY, HAS STOPPED"
Please if u have any idea 'bout to fix this problema i'll be more than thankful.
PS: i'm using the ADT BUNDLE FOR WINDOWS which has Eclipse, sdk, sdk manager. just for the record.
...And just in case u ask me for the log error here it is:
Guys thanks a lot for your help! i know it's kinda boring but thanks anyway.
Here is the manifest should i add the new activity in this part of the code or where?
have you created a new activity?
every activity created must be added to the manifest file of the app otherwise the app will crash when that activity is started.
heres how you add it to the manifest:
<activity android:name="com.android.test.ActivityName"
android:label="#string/activity_label" ></activity>
where com.android.test.ActivityName is the name of the activity as it appears in the package
add that between the <application> </application> tags
I'm using Eclipse and android SDK (with ADT Plugin), I don't know if it's some kind of configuration issue or it's some code problem. Whenever I load an app that I made from scratch (this means not using another existing code or one sample from the library) to my device or run it on the emulator, the entire app will load as "separate" apps, which are the activities. For example, if the app is named "Hello world" and it has two activities, "MainActivity" and "SecondaryActivity", both of them will show up on the device with their names as app names and sharing the app icon on the menu. Now, if I go to settings, "Hello World" appears as an application, now behaving again like it should. This doesn't affect the operation of the app, however, it's annoying to have more than 1 icon launching the same app. The problem is that, when i first used eclipse, this was not happening.
Just in case it helps, I've already re-installed the entire android SDK and the ADT plugin, as well, I tried using 3 different Eclipse versions (classic, EE, and Java developers), none of them seem to work, even though, in the Graphical Layout for any activity, the name of the app is showed in the bar with the app's icon, but running on the emulator or a real device it shows the activity's name there instead. I've looked everywhere and I haven't solved the problem.
Thanks!
Check your manifest to see if more than one activity has this:
<category android:name="android.intent.category.LAUNCHER" />
The answer I found for the above problem is, replace category.LAUNCHER to category.EMBED in all the activities apart from the MainActivity in your manifest file.
If I don't modify source code and compile, I get "Activity not started, its current task has been brought to the front" message. Is there option in Eclipse to force it to run without changing source code?
If u want to enforce it do this.
I do this usually though it sounds lame. Add a space anywhere in your code (in any file). Just Save the project and run. It will then go through the uploading and installing process again. This is the easiest way to go about it without actually changing any code that matters.
why dont u try running it from Emulator again, If you are not modifying source, it will do the same as you mentioned, Either change source(you can add logs, or just do blank enter in any file.) or close it and open it from Emulator.
-->This happens only if there is no change from the previous run of your Application.
-->To Avoid this , You can either::
Close your Application and then Compile,
You have to change atleast 1 file of you code and then can Compile it.
There is another way to solve this problem. Run the another app and than run your current app, so you not get this type of error message. And not needed to change the code or adding unnecessary spaces. and it also save your time which can waste to restart the emulator.
If u dont modify the code and want to re-run the code in emulator,the system just throws the warning that the code you are trying to run is already executed.Even i have faced this warning several times.You can do is make some changes in code and try to run again or just finish up all the activities in front and than try to run.It will run successfully.
In my opinion 'Activity not started, its current task...' is really tedious. In some cases I changed nothing in source code, but need to restart because I changed the data
Clean your project(Menu->Project->Clean) then Run it again.
Works for me.