I am working on an app that shows a google map (api v2) as a fragment. When the app loads it shows a blank white screen for a couple of seconds before showing the map. I have used log statements see where the delays is but I don't know why it's so slow.
Here is my onCreate:
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate Start -------------------------------");
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate 1 -------------------------------");
setContentView(R.layout.activity_main);
Log.i(TAG, "onCreate 2 -------------------------------");
do_async_setup();
Log.i(TAG, "onCreate 3 -------------------------------");
prefs = getSharedPreferences(PREFS_NAME, 0);
prefs_editor = prefs.edit();
Log.i(TAG, "onCreate Finish -------------------------------");
And here is the output.
01-20 10:05:28.802: I/HeadsUp(19544): onCreate Start -------------------------------
01-20 10:05:28.802: I/HeadsUp(19544): onCreate 1 -------------------------------
01-20 10:05:30.396: I/HeadsUp(19544): onCreate 2 -------------------------------
01-20 10:05:30.396: I/HeadsUp(19544): onCreate 3 -------------------------------
01-20 10:05:30.403: I/HeadsUp(19544): onCreate Finish -------------------------------
You can see a 1.5 sec delay for setContentView. Here is my layout.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
It's simply looks bad, like the app has frozen when loading. How can I either speed this up or hide the delay?
thanks,
2000ms
even innon-debug
. – Sourdough