In my android app I have an initial activity which popup a dialog (used as the splash screen). I am doing this:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Popup a fullscreen dialog (used as splash)
showSplashScreen();
}
However there is a small time period before this where a blank empty with my logo and title bar show up. I have no idea how to remove this from showing at all. I even tried to see if this was coming from the same activity, I check by removing the title bar by requesting no title bar. However, I had no luck... This mysterious blank activity shows up for a small time interval.
How do apps like facebook show an initial splash screen first without showing anything else before?
use setContentView(R.layout.layout_name); in the code.
Describe the Activity that you want to open as a dialogue in the manifest file as:
<activity
android:name=".Description_Activity"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Dialog" >
</activity>
requestWindowFeature(Window.FEATURE_NO_TITLE);
in onCreate or
android:theme=”#android:style/Theme.NoTitleBar”
in your activity tag of manifest should hide the title bar.
And please make sure this activity is your first activity on start.
I've added the following line to my custom style:
<item name="android:windowDisablePreview">true</item>
Related
I am developing an android application which contains a full screen activity but i am unable to hide default android battery , time etc. icons from the screen
For example :-
I think this is something like android immersive full screen view
So can any one tell me how can i achieve this
you can do it in java file by
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
or in AndroidManifest.xml
<activity android:name=".ActivityName"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"/>
With transparent notification bar read this link.
There is a new feature called Immersive FullScreen mode where all the UI elements other than your Activity are hidden. One can get those those back by swiping down.
Use the following code to achieve this :
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|View.SYSTEM_UI_FLAG_IMMERSIVE|View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
When I am trying to start second activity from the first one, but it shows me black screen before showing new activity layout. Here is my code:
Intent intent = new Intent(MessagesActivity.this, MessageTextActivity.class);
intent.putExtra("Sender", items.get(position).subject);
intent.putExtra("Date", items.get(position).date);
intent.putExtra("Text", items.get(position).text);
intent.putExtra("Position", position);
startActivity(intent);
On Android other than KitKat when I add in manifest under application android:theme="#android:style/Theme.Translucent.NoTitleBar", I don't see black splash when starting other activity. Which is great, but if I remove android:theme the black splash is back.
In the other hand, on KitKat, when I remove
android:theme="#android:style/Theme.Translucent.NoTitleBar" from manifest, it works good.
But, if I keep android:theme="#android:style/Theme.Translucent.NoTitleBar" I also don't see black splash screen when opening other activity, but I have other problem. The problem is if user clicks that View which starts new activity a lot of times, than if there is some icon on desktop in that place, that application gets started! It seems that my activity(the one where I click View to open other) disappeared, and user clicked on icon on desktop (home screen).
Putting android:theme="#android:style/Theme.Translucent.NoTitleBar" in manifest helps me in all versions of Android except in KitKat.
Edit: 15/8/2014
This View I am clicking on is a ListView item. When I click on View the first time I don't see black screen flash. But if I exit the activity I just entered(click on Back), and if I wait for 1-2 seconds and I click on the View I don't see black flash again. But If I click before 1-2 seconds, then the black screen flash appears.
In the first activity, in onResume method, I don't have anything. And in second activity, in onCreate method, I have this code:
ThemeManager.loadTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_message);
initTextViews();
initActionBar();
In ThemeManager.loadTheme(this) I set the style in my activity (because user can change themes in the app), and that styles are defined like this:
<style name="Theme.MyTheme.Blue" parent="#style/Theme.Sherlock.Light"> and <style name="Theme.MyTheme.Green" parent="#style/Theme.Sherlock.Light">
I use Sherlock Styles.
Solution :)
I found what was causing this black screen. I added animation when closing the second activity, and showing the first one. The entering duration of animation was longer than duration of exiting activity. The entering animation was still in progress, and then I click View which opens new activity with black screen flash! Anyway, many thanks on suggestions.
I faced a similar problem, and solved by adding theme to second activity in AndroidManifest.xml:
<activity android:name="com.example.SecondActivity"
android:theme="#style/AppTheme.Transparent"/>
My appliation do the following:
Start a alarm
after 10 second
open a Activity (ThemeDialog)
The output is as follows
I would like to do the following:
Just show the dialog without showing the main activity
But the current situation is that the main activity is opened when I open my dialog activity.
How to hide it (when the alarm timesup, i just want to display a dialog)? Just like the following screen shot:
http://www.whatsappen.nl/wp-content/uploads/2012/05/popup21.jpg
You just also finish activity and than open new activity. New Activity' s style to android:theme="#style/Theme.Translucent" in your manifest file. And than set a view maybe empty textview, open dialog.
you can acheive this by using custom dialog
.in this give background color to black it will hide back activity
or you can acheive this by launching activity as dialog
Start activity as dialog i used this
<activity android:theme="#android:style/Theme.Dialog" />
now when i startActivity(in) it displays like dialog.
instead of showing dialog in activity you can directly use dialog theme in manifest file for activity.and use that activity as a dialog box.
I am trying to make a tab activity. It works fine . I make
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" in the definition in manifest file. But sometimes it does not take the full screen when launching. My program starts from a splash screen. That is an normal activity. My tab is at the buttom of the screen. So the tabs are go inside the screen.
Does Anyone know about the problem?
Remove .FullScreen and instead use
android:theme="#android:style/Theme.NoTitleBar"
with your activity tags in AndroidManifest.XML, worked out for me
EDIT
in your Activity onCreate method use
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Let's say I have a basic widget with a button. When i click on this button I would like to display a input dialogue window, still on top of the home screen, where upon entering some value and clicking submit I will see the home screen again.
What I do now is to start an activity with a dialogue which is placed on top of the main activity in my application. Perhaps there is just a simple flag to hide the main activity?
Thankful for any help.
To answer my question, this is what needed to be put in the manifest for my dialog activity.
<activity android:name=".InputDialog"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.Dialog"
android:excludeFromRecents="true">
</activity>