Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13841] Android: Black screen is displayed shortly when launching new activity

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-07-22T18:37:06.000+0000
Affected Version/sRelease 3.1.0, Release 3.2.0
Fix Version/s2013 Sprint 15 API, 2013 Sprint 15
ComponentsAndroid
Labelstriage
ReporterPhilippe Wueger
AssigneeIngo Muschenetz
Created2013-05-13T11:39:57.000+0000
Updated2017-03-21T21:35:43.000+0000

Description

*Problem* Sometimes, when a new activity is launched, a black screen is displayed shortly before the content of the new activity is displayed. This flickering is disturbing to the user experience. *Steps to reproduce* 1. Launch the app with the code below. 2. Scroll to the end of the table. 3. Scroll a little further so that the blue fading edge at the bottom appears and then within about max. 1 second tap on a list item. 4. The screen will go black quickly before the content of the new activity (blue background color) appears 5. If one waits a bit after scrolling and before tapping the item, this behavior does not appear This is just one possibility of triggering this problem. The problem occurs with other user interactions as well, but I assume the reason for the problem is probably the same. *Test case*
var win = Ti.UI.createWindow({
	backgroundColor : 'red'
});

var items = [];
for (var i = 0; i < 40; i++) {
	items.push({
		properties : {
			title : 'Item' + i,
			image : 'https://raw.github.com/appcelerator/titanium_mobile/master/android/templates/app/default/Resources/android/appicon.png'
		}
	});
}

var section = Ti.UI.createListSection({
	items : items
});

var listView = Ti.UI.createListView({
	sections : [section]
});

listView.addEventListener('itemclick', function(evt) {
	var win2 = Ti.UI.createWindow({
		backgroundColor : 'blue',
		modal : 'false'
	});

	win2.open({
		animated : false // disable animations between activities so the effect is better visible
	});
});

win.add(listView);
win.open();

Comments

  1. Daniel Sefton 2013-05-13

    Tested and confirmed with Nexus 7 Android 4.2, Ti SDK 3.1 GA and latest 3.2 CI. Cannot reproduce with Samsung Galaxy S2 Android 2.3.6 - although the ListView is much faster on that device. It's very subtle though - speaking in terms of priority, it's a very minor issue.
  2. Martin Guillon 2013-05-14

    I have been trying to reproduce this, and i can't reproduce it on: Samsung Galaxy S2 Android 4.2.2 and latest 3.2.0 I should mention that i am trying to reproduce it with a tableview. Philippe, can you reproduce it with a tableview? Though i have already seen that behavior. Will try and insist on this one
  3. Philippe Wueger 2013-05-15

    It seems that this problem is not occuring on all devices. To answer your question Martin: Yes, I have also seen this behavior with a TableView. I can also reproduce this behavior with only a window without a ListView or TableView, altough this may be a bit of a special/edge case: Have a window open a new activity with a click event listener. Double tap on the window and the flickering will appear when the two new activities are opened. All in all, I don't think the issue is related to the ListView directly. It seems to me, that there is something which is delaying the layouting (onLayout method in TiCompositeLayout.java) on the new activity in some cases (e.g. when overscrolling in a ListView shortly before) which leads to a black screen being displayed shortly. In my opinion, this is not a minor issue. It can be very disturbing within an actual app, when this happens about 50% of the time on launching new activities.
  4. Philippe Wueger 2013-06-01

    I did some testing and noticed that the behavior is triggered when it takes too long after starting a new activity before the properties of the new window are applied. I looked at the timespan between sending the message "MSG_MODEL_PROCESS_PROPERTIES" in KrollProxy setModelListener and actually processing the properties in TiUIActivityWindow processProperties. This timespan is around 40ms when no black screen is shown and there is a nice transition between the old and the new activity. When a black screen is shown during the transition, this timespan is always above around 120ms. By changing the line
       getMainHandler().sendEmptyMessage(MSG_MODEL_PROCESS_PROPERTIES);
       
    to
       Message msg = getMainHandler().obtainMessage(MSG_MODEL_PROCESS_PROPERTIES);
       getMainHandler().sendMessageAtFrontOfQueue(msg);
       
    in KrollProxy setModelListener, the properties are always applied fast enough, so that no black screen appears anymore and there is always a nice transition. I can't judge if this change has any unwanted side effects, but I have not noticed anything in a rather complex application which I tested this change with.
  5. Philippe Wueger 2013-06-01

    Pull request for the change mentioned in the last comment: https://github.com/appcelerator/titanium_mobile/pull/4348
  6. Ping Wang 2013-07-22

    Cannot reproduce with the latest master. Probably fixed by TIMOB-13796.
  7. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced and due to the above comments.

JSON Source