ImageLoader加载图片
MainActivity:
private Button bt;
private ImageView iv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//获取组件id
bt = (Button) findViewById(R.id.bt);
iv = (ImageView) findViewById(R.id.iv);
bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DisplayImageOptions options = new DisplayImageOptions.Builder().build();
//加载图片
ImageLoader.getInstance().displayImage("https.......",iv,options);
}
});
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Application类
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------manifests配置
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
android:name=".MyApplication"