Android notification bar persists on the all Application screen(never goes) - java

I have a screen in my app with a button to set date/time in the OS. I use startActivity(new Intent(android.provider.Settings.ACTION_DATE_SETTINGS)) to open the android's date/time screen .
After setting the date/time , i return to my app screen using the back button in the android's status(notification) bar. After this, the notification bar never dissappears from my app screens. Its persistent until i restart my application. Is there a way to remove the notification bar?
I have added the line "android:theme="#android:style/Theme.NoTitleBar.Fullscreen" to all my activities and even at at the application level(just inside )
But still it never goes
Here is a part of my manifest
<activity
android:name="com.cyberonics.progsoundapp.ui.AlarmSettingScreen"
android:configChanges="keyboardHidden|orientation"
android:label="#string/title_activity_alarm_setting_screen"
android:screenOrientation="landscape"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
I also have the following code in my activity class
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN) before SetContentView()
Is there anything else i am missing?
Request your guidance on this
Thank you

Related

Cannot hide app from recent list when overview button clicks

I want to hide my A activity from recent list, and i used excludeFromRecents="true", it works fine when i select home button and then select overview button, but when A activity is showing and i press overview button, activity exists in recent list, how can i hide A activity in that situation?
here is my activity tag in manifest :
android:name=".A"
android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:screenOrientation="portrait"></activity>

How Can I Change Start Page of Android Studio for LibGDX

I create a game with LibGDX and I made a main menu for it but I can't do start page this main menu. How Can I do it? Can you help me
enter image description here
You see that
<intent-filter>
<action ...
<action ...
</intent-filter>
part of code? That code controls which one of your activities will be the launching/main activity. Just cut that intent filter and paste it inside of your AndroidLauncher activity tag (which I pressume is your menu).

Android dialog theme makes setContentView crash the application

I'm applying this theme from manifest :
<activity
android:name=".ui.rate.MyActivity"
android:theme="#android:style/Theme.Dialog">
</activity>
With this the application crash on setContentView() of MyActivity. If I remove it there is no crash but I need this theme
In the activity onCreate() i'm doing this :
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_rate);
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
Even if I remove the first and third lines the applicatio ncrash the same way. It's really the dialog theme that's causing the crash
How can I set it so that Android accept it ?
You can use Theme.AppCompat.Dialog as the theme of your activity to avoid
compatibility problem.
The activity will be presented as a dialog.
<activity
android:name=".MainActivity"
android:theme="#style/Theme.AppCompat.Dialog">
</activity>
As for the title, you can use setTitle("Hola!"); to change it.
If you wanna remove the title, just call:
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
for android:theme="#style/Theme.AppCompat.Dialog",
and:
requestWindowFeature(Window.FEATURE_NO_TITLE);
for android:theme="#android:style/Theme.Dialog".

how to make professional back button in action bar

I made back button by using activity parent and getactionsupport just like this:
<activity
android:name=".News_details"
android:parentActivityName=".Main2Activity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.package.Main2Activity" />
</activity>
I also add this to my activity in the manifest.
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
so what the result that I get ?
The blue arrow displays properly when I run my app in android version 4.+. When I use android version 5.+ the blue arrow reveres direction.

How can I show a specific activity when application enters foreground from background?

I have an application with several activities.One of them is Login activity and this activity defined as MAIN in my app in manifest:
<activity
android:name="com.company.myapp.AuthorizationMainActivity"
android:label="#string/app_name"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The problem when my app enters background (e.g. I press home button) and then I open the app again - the Login page is showed to me. How can I show activity which was active for user at the moment application enter background?
If you don't explicitly want to use it for a special requirement, remove "android:launchMode="singleTask".
A "singleTask" activity allows other activities to be part of its task. It's always at the root of its task, but other activities (necessarily "standard" and "singleTop" activities) can be launched into that task. (found here at Android Developes)
Use a dummy activity as your base activity that launches and in that activity check to see if you need to display the login activity or another one. Then start that specific activity you want to go to from the dummy activity.
make sure you set the dummy activity to noHistory in the manifest so the user cannot navigate back to it
if(needsLogIn){
Intent i = new Intent(this,LoginActivity.class);
startActivity(i);
}else{
Intent i = new Intent(this,OtherActivity.class);
startActivity(i);
}
Remove android:launchMode="singleTask" > singletask activity will be the root and when you press home button all the activities above it will be removed. when you remove android:launchMode="singleTask" then the default behaviour will take place ie when you press home button and then launch again it will open the activity from where you left. have a look at the link http://developer.android.com/guide/components/tasks-and-back-stack.html

Categories