Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25220] Android: ImageView doesn't accept File

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-09-21T23:29:17.000+0000
Affected Version/sRelease 6.2.0
Fix Version/sRelease 6.2.0
ComponentsAndroid
Labelsautomated, regression
ReporterMichael Gangolf
AssigneeGary Mathews
Created2017-09-01T15:12:30.000+0000
Updated2017-10-05T21:21:45.000+0000

Description

Summary: In 6.2.0.RC getFile() returns a FileProxy that can't be shown in an ImageView *Steps:* * Create a default Titanium Classic project * add this code:

var win = Ti.UI.createWindow({backgroundColor: 'grey'});
var f = Ti.Filesystem.getFile("assets/images/tab1.png");
if (f.exists()) {
	console.log("file exists");
	var img = Ti.UI.createImageView({
		image: f,
		top: 10
	});
	win.add(img);

	var img2 = Ti.UI.createImageView({
		image: f.nativePath
	});
	win.add(img2);
} else {
	console.log("file does not exists at " + f.nativePath);
}
win.open();
*Output* 6.1.2.GA shows both images: !612_ga_images.png|thumbnail! 6.2.0.RC only shows one image: !6_2_0_rc_images.png|thumbnail! and this error: {noformat} TiDrawableReference: (main) [83,83] Unknown image resource type: FileProxy. Returning null drawable reference {noformat}

Attachments

FileDateSize
6_2_0_rc_images.png2017-09-01T15:10:21.000+000031169
612_ga_images.png2017-09-01T15:10:21.000+000030694

Comments

  1. Ewan Harris 2017-09-01

    Thanks for the report [~michael], moving over to TIMOB Can reproduce using Ti SDK 6.2.0.v20170831112315 OnePlus 3 7.1.1
  2. Gary Mathews 2017-09-04

    master: https://github.com/appcelerator/titanium_mobile/pull/9392 6_2_X: https://github.com/appcelerator/titanium_mobile/pull/9394
  3. Lokesh Choudhary 2017-09-05

    FR Passed for master & backport. PR's merged.
  4. Lokesh Choudhary 2017-09-06

    Verified the fix in SDK 6.2.0.v20170906064110 & 7.0.0.v20170906103333. Closing. Studio Ver: 4.9.1.201707200100 SDK Ver: 6.2.0.v20170906064110 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.4-9 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.13 Node Ver: 6.11.2 Java Ver: 1.8.0_101 Devices: ⇨ google Pixel --- Android 7.1.1 ⇨ google Nexus 5 --- Android 6.0.1 Emulator: Android 4.4.2
  5. Lokesh Choudhary 2017-09-18

    Reopening to correct code in steps.
  6. Lokesh Choudhary 2017-10-05

    Code for appium automation:
       var win = Ti.UI.createWindow({backgroundColor: 'grey'}),
         file = Ti.Filesystem.getFile('titanium.png'),
         img = Ti.UI.createImageView({
           width: 100,
           height: 100,
           image: file
         });
       win.add(img);
       win.open();
       

JSON Source