I am developing an android application. If I close my application, my app available in the "Recent Apps" List. Now I don't want to show it in "Recent Apps". How can I remove it from "Recent Apps List" after closing my application programmatically. Please can you share your suggestions.
In you Manifest.xml, set the following to your Root Activity
<activity
android:name=".Your_Root_Activity_Name"
android:excludeFromRecents="true"
....
</activity>
Depending on the results, you might also have to use the android:noHistory="true" attribute. But not sure if it is required in your case.
For more information about this: http://developer.android.com/guide/topics/manifest/activity-element.html
Add excludeFromRecents="true" to your activity in AndroidManifest.xml:
<activity android:name=".MainActivity"
android:excludeFromRecents="true" ...
override the onResume methods in your other Activities and there destroy them and call the main Activity.
In your AndroidManifest.xml, use this for Activity:
<activity
android:name="Your Activity"
android:excludeFromRecents="true"
android:noHistory="true"
android:taskAffinity="">
</activity>
Related
have done a project with buttons to allow me to navigate on the web but I'm getting an error and my app is stopping right after the splashscreen. any help??
In your Manifest add following <activity /> tag after your MainActivity's <activity> block:
<activity
android:name=".LMCome"
android:parentActivityName=".MainActivity" />
The following is found on https://www.oreilly.com/library/view/application-security-for/9781449322250/ch04.html
with the comment "To require a certain permission to start an Activity, you need to add the permission attribute to the specific Activity’s entry in AndroidManifest.xml."
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testapps.test1">
...
<activity android:name=".Activity1"
android:permission="com.example.testapps.test1.permission.START_ACTIVITY1">
<intent-filter>
...
</intent-filter>
</activity>
...
</manifest>
What should I do if I want to prevent to start the activity? Not setting the permission seems to let the activity start without any permission...
If you don't want the activity to be launched then use the following to mark it as disabled.
android:enabled="false"
What should I do if I want to prevent to start the activity?
Remove the <intent-filter>. Your <intent-filter> is saying "I want other apps to start this activity". Activities without an <intent-filter> can still be started by your app, used in PendingIntent objects, etc.
I want Don't show my app in recent app when user run or close my app in hdevice
my purpose is:
user Disabling to run my app
i am sorry for bad speak .
Try this..
For your every activity android:excludeFromRecents="true"
<activity
android:name=".Activity"
android:excludeFromRecents="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
For more information refer this doc
From Android Doc
Read this.
android:excludeFromRecents
Whether or not the task initiated by this
activity should be excluded from the list of recently used
applications ("recent apps"). That is, when this activity is the root
activity of a new task, this attribute determines whether the task
should not appear in the list of recent apps. Set "true" if the task
should be excluded from the list; set "false" if it should be
included. The default value is "false".
add android:excludeFromRecents="true" in your xml (AndroidManifest.xml) for the activity tag
excludeFromRecents is what you are looking for.
Just add this to your Activity tag in the AndroidManifest.xml:
android:excludeFromRecents="true"
I am in trouble, I want to start my application from starting every time but it's not being.
When I exit from my application & come again. I found same activity which I have left before exit.
Now If I **shut down or switch off** my Android Device direct when my application is in foreground & then I **switch on device again**. I get same activity which I have left earlier. But I want to fresh application from login page. Because my setter & getter is null after switch on device, and I found all value null in my application.
My Manifest file is below:
<activity
android:name=".Main"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Dialog" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".screens.ScreenSplash"
android:screenOrientation="portrait" />
<activity android:name=".screens.LoginActivity" />
<activity
android:name=".screens.LoginActivity"
android:configChanges="orientation|keyboardHidden" />
<activity
android:name=".screens.MainMenu"
android:configChanges="orientation|keyboardHidden" />
Kindly help me which is the problem & what should I do. Any help would be appreciated.
Add to your activity manifest
android:clearTaskOnLaunch="true"
According to your Manifest .Main is the launcher activity. so when your application is launched from icon tap then this is the first activity to display and rather if your application is not having any other activity on top of the stack.
so if you want to see the fresh login activity then make the login activity as launcher activity.
Maybe you want to try setting launchMode to standard?
http://developer.android.com/guide/topics/manifest/activity-element.html
So, I have this app with 4 different activities:
A is the main activity with three buttons to launch B, C and D (I think people use to refer to these as sub activities).
Each activity has its own layout, but I believe that this is not relevant
here.
What I want to do is the standard behaviour for most apps. That is:
I start by launching the app and seeing activity A.
Then I press a button, C, for instance, and activity C is shown.
Then I press the back button and activity A is shown again.
My app does points 1 and 2 correctly, but on 3 the app disappears.
The onClick method of the buttons has something like this:
startActivity(new Intent(this,C.class));
None of the activities overrides the onBackPressed method.
Here is (part of) my manifest file:
<activity android:name=".A" android:label="A" android:launchMode="standard" android:theme="#android:style/Theme.NoTitleBar" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".B" android:label="B" android:launchMode="standard" android:theme="#android:style/Theme.NoTitleBar" android:screenOrientation="portrait"/>
<activity android:name=".C" android:label="C" android:launchMode="standard" android:theme="#android:style/Theme.NoTitleBar" android:screenOrientation="portrait"/>
<activity android:name=".D" android:label="D" android:launchMode="standard" android:theme="#android:style/Theme.NoTitleBar" android:screenOrientation="portrait"/>
I know from debug work I've done, that A.onDestroy() is called after the onClick method of a button is called.
Based on this info, I think that, and of course I might be wrong, activity A is removed from history stack by the OS for some reason.
Now I know that this kind of issue has already been addressed here on stackoverflow, but I've tried all the suggestions I could find and none worked.
I wanted to explain my own case.
Of course that I should be doing something wrong.
I was overriding the onWindowFocusChanged method and destroying the activity there, so of course it was being removed from the stack.
I am sorry for wasting your time #stefan and #colegu.