Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1367] TiDrawableReference.getBitmap(true) fails on the second retry (android)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2014-06-12T04:40:39.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, mobilesdk
Reportergrebulon
AssigneeRitu Agrawal
Created2014-05-26T07:48:19.000+0000
Updated2016-03-08T07:37:47.000+0000

Description

There's a bug in TiDrawableReference.getBitmap(true) Calling BitmapFactory.decodeStream(is, null, opts) the second time in the retry loop fails because the input stream (is) has to be rewound. At the beginning of the retry loop, you need to add something like: {noformat} if (i > 0) is = getInputStream(); {noformat} and also make sure that it is not null.

Comments

  1. Ritu Agrawal 2014-05-27

    Thank you for your suggestion but we need a simple test case to reproduce this issue.
  2. grebulon 2014-05-28

    This is not a suggestion - it is a BUG report. Just find a huge image on the internet (search for very high resolution world map) and load it into an image view. You need to cause an out of memory exception. Or you can manually insert code to simulate this. I gave you a very good description of the problem and how to solve it, this should be enough. I don't have time to write your unit tests for you.
  3. Ritu Agrawal 2014-06-12

    We have not been able to reproduce this issue and the reporter has declined to provide a test case.

JSON Source