1
我使用JSON解析在我的網址非常大尺寸圖像在那裏,我希望讓那些無法下載圖像.....任何機構可以幫助我獲得這些圖像 我的代碼如下enter code here
如何解析非常大的圖像?
公共類Image延伸活動{
String imageBaseDirectory = "http://www.dha.com.tr/newpics/news/";
Bitmap bit;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.image);
ImageView img=(ImageView)findViewById(R.id.ImageView01);
img.setImageBitmap(convertImage(imageBaseDirectory));
}
公共位圖convertImage(字符串或多個) {
URL aURL = null;
try
{
final String imageUrl =s.replaceAll(" ","%20");
Log.e("Image Url",imageUrl);
aURL = new URL(imageUrl);
URLConnection conn = aURL.openConnection();
InputStream is = conn.getInputStream();
//@SuppressWarnings("unused")
BufferedInputStream bis = new BufferedInputStream(is);
Bitmap bm = BitmapFactory.decodeStream(new PatchInputStream(bis));
if(bm==null){}
else
bit=Bitmap.createScaledBitmap(bm,60, 60, true);
return bit;
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
}
重複http://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue – 2012-02-21 13:35:50