CopyPastor

Detecting plagiarism made easy.

Score: 0.7590232491493225; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-05-03
by ORBIT

Original Post

Original - Posted on 2012-06-09
by Luke Taylor



            
Present in both answers; Present only in the new answer; Present only in the old answer;

**try this out**
val bitmap = assetsToBitmap("ic_launcher_background") private fun assetsToBitmap(fileName:String): Bitmap?{ return try{ val stream = assets.open(fileName) BitmapFactory.decodeStream(stream) }catch (e: IOException){ e.printStackTrace() null } } // Method to convert a bitmap to bitmap drawable private fun bitmapToDrawable(bitmap:Bitmap): BitmapDrawable { return BitmapDrawable(resources,bitmap) }
This worked for me!
public Bitmap readAssetsBitmap(String filename) throws IOException { try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPurgeable = true; Bitmap bitmap = BitmapFactory.decodeStream(assets.open(filename), null, options); if(bitmap == null) { throw new IOException("File cannot be opened: It's value is null"); } else { return bitmap; } } catch (IOException e) { throw new IOException("File cannot be opened: " + e.getMessage()); } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;