第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

BitmapFactory.decodeStream(is); 內存溢出,,這個問題咋解決啊


? ?URL fileUrl = null;

? ?Bitmap bitmap = null;

? ?InputStream is = null;

? ? Log.v("jsonpic","圖片地址"+ Strurl);

? ? ? ?try {

? ? fileUrl = new URL(Strurl);

? ? ? ?HttpURLConnection conn = (HttpURLConnection) fileUrl

? ? ? ? ? ? ? ?.openConnection();

? ? ? is =new BufferedInputStream( conn.getInputStream());

? ? ? ? ?

? ? ??

? ? ? bitmap = BitmapFactory.decodeStream(is);

? ? ? ?

? ? ? ?conn.disconnect();//釋放資源

? ? ?

? ?} catch (IOException e) {

? ? ? ?e.printStackTrace();

? ? ? ?Log.v("jsonpic", e.toString());

? ?}finally{

? ? ?is.close();

? ?}

? ?return bitmap;


正在回答

1 回答

主要是你下載的圖片太大了,加載到內存造成了內存的溢出

android 提供的api文檔中Training>>Building Apps with Graphics & Animation>>

Loading Large Bitmaps Efficiently 提供了解決該問題的思路

0 回復 有任何疑惑可以回復我~
#1

一個小屁孩兒 提問者

可以講的明白些嗎,大姐
2016-05-16 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Android必學-BaseAdapter的使用與優(yōu)化
  • 參與學習       42580    人
  • 解答問題       96    個

了解數(shù)據適配器的使用方法,寫出高效、文藝的BaseAdapter

進入課程

BitmapFactory.decodeStream(is); 內存溢出,,這個問題咋解決啊

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號