Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16816] Android: Cannot refer default splash screen image (default.png) for image view

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.2
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, bug, cb-tooling
ReporterThijs van Mil
AssigneeChris Barber
Created2014-04-02T11:02:45.000+0000
Updated2017-01-04T18:05:23.000+0000

Description

When trying to create an ImageView, you cannot use the splashscreen images (default.png) on Android. The usecase is a dynamic loading screen that is displayed while the app is starting up. This loading screen must have the splash image as the background so it looks like the default splash screen of the app. Neither the standard default.png nor the density-specific images can be referenced to use as background for the window or image parameter for an ImageView. The warning in the console is: [WARN] : TiDrawableReference: (pool-3-thread-1) [1889,1889] Could not open stream to get bitmap A workaround is to duplicate every default.png in every folder, and rename it to something else (default2.png or test.png for instance). Then it does find the resource. Testcase:
var win = Ti.UI.createWindow({
	backgroundColor : '#ffffff',
	navBarHidden : true,
	exitOnClose : true
});
var view = Ti.UI.createView({ backgroundColor: "#fdd" });

var imgView = Ti.UI.createImageView({
	image: '/images/default.png',
	width: 150,
	height: 150
});
view.add(imgView);

win.add(view);
win.open();

Comments

  1. Ritu Agrawal 2014-04-06

    Moving this ticket to engineering as I can reproduce this issue with the provided test case. Same test works fine on iOS platform.
  2. Seth Benjamin 2014-04-09

    While not an appropriate solution to this problem, because of how resources are looked up you can use: Ti.App.Android.R.drawable.background to access the splash. While not the best, in the meantime this is a solution.
  3. jithinpv 2014-08-29

    Issue reproduces Titanium SDK version 3.4.0 master, 3.3.0.GA, 3.2.3.GA, 3.2.2.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Motorola Moto G, Android version : 4.4.4
  4. Chris Barber 2017-01-04

    This behavior has been around a long time and it is by design (and not the good kind). We have discussed a Titanium Asset Management system that will separate out system managed resources (such as splash screens) from Titanium controlled assets (i.e. Resources/images). View TIMOB-19298 for more information.

JSON Source