Make starting up an Activity in a different process faster - android

From my own app I'm starting an Activity that needs to be in another process, declaring it in the manifest:
<activity
android:name="ActivityName"
android:process=":DifferentProcess"
android:label="#string/app_name"
android:theme="#style/AppTheme" />
And starting it with an Intent as usual.
This new Activity creation always shows a white screen between activities; it's OK on a device like Nexus 5X, but on low-end devices the white screen appears for 1-3 seconds.
Is there anything I can do about it? Either make it faster or show a "Loading..." view while the process starts up?

In your theme add this tag
<item name="android:windowDisablePreview">true</item>
this will disable the white screen between activities.
On startup You can use a splash screen to hide the blank screen. Now an activity level splash screen. But splash screen as a background.
https://stackoverflow.com/a/14307263/4804264

Related

Android splash screen / launch screen also shows when keyboard is resizing

I have a blue image as splash screen for startup.
However inside my app when an open keyboard is closed it shows the background imagine of the splash screen for a brief second which looks very weird.
windowSoftInputMode is set to
android:windowSoftInputMode="adjustResize"
I think adjustResize is right.
What could I do to solve the problem? Why is the splash screen even in the background?
No clue if you do this already, but for activities like a splash screen where you only use it once and returning isn't wanted, remember to call finish(). If you finish the activity, it will not be in the activity stack. Try adding finish() after the intent that takes you away from the splash screen

Starting activity shows black flash

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"/>

Screen flashes white on EditText focus

My application has many different screens, but only screens with EditText's on them have this bug.
The page loads at a normal speed but once the user clicks in an EditText, The enitre screen flashes white except for the ActionBar for a noticable amount of time (maybe a quarter to half a second) and then goes back to what it is supposed to look like (the background is gray not white). This only happens on the first EditText focus after the activity starts so once the screen flashes once, it won't do it again unless the activity is reloaded.
Here is the relevant part of the manifest:
<activity
android:name="com.bottegasol.com.android.migym.View.Views.FeedbackActivity"
android:label="#string/title_activity_feedback"
android:logo="#android:color/transparent"
android:screenOrientation="portrait"
android:theme="#style/Theme.Example"
android:uiOptions="splitActionBarWhenNarrow" >
</activity>
There is nothing in it related to the SoftKeyboard resizing or anything like that. And the code contains no focus or keyboard change listeners.
I got this bug on a Motorola Razor Maxx and an HTC One X both running Jellybean. My emulator running api 10 didn't get this problem. Does anyone have any idea of where to start hunting for this? I couldn't find anyone else with this issue.

How to avoid showing the title bar when phonegap app starts on Android?

I have a splash screen for my phonegap app on android. However, everytime before showing the splash screen, a blank screen with a header bar (an icon with the app name) will be shown before the splash screen. How do I make that disappear?
Try requestWindowFeature(FEATURE_NO_TITLE) in your activity's onCreate() method
if you could go for fullscreen as well then this may help if you add this in your mainfest -
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">

On ICS devices Current Activity disappearing when screen gets locked

In activity manifest file i have marked it as android:noHistory="true" because I did not want the screen to be added to the activity stack.
when I lock the screen and unlock it. The activity disappears and the previous screen appears. This should not happen. Please any one can suggest me, how can i handle this on ICS devices. However its working fine on Gingerbread devices.
Remove android:noHistory="true" in android manifest file and call the finish when you move out of that Activity. This will remove the activity completely from the stack and it will not be displayed in your backstack. I hope this will work for you

Categories

Resources