Best way to save images which comes from server in android

后端 未结 3 865
甜味超标
甜味超标 2021-01-14 11:27

I am working on one application and getting product images from the server. Currently I am saving those images into the SQLite database after converting them into byte a

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-14 11:57

    Demo code

    package com.example.demo;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.ImageView;
    
    public class MainActivity extends Activity {
        private AQuery androidQuery;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            ImageView img = (ImageView) findViewById(R.id.img);
            androidQuery = new AQuery(this);
            androidQuery.id(img).image(imgUrl, true, true);// donload and save to sdcard if it is already in sdcard will not download again.
    
        }
    
    }
    

提交回复
热议问题