我正在为我的项目使用heinrichreimersoftware'Material抽屉库。要从Drawer项目中的URL加载图像,我正在使用滑动。如何从uri中的Draweritem中的uri加载图标/头像
final ImageView image = new ImageView(this);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
Looper.prepare();
try {
theBitmap = Glide.
with(MainActivity.this).
load(FirebaseAuth.getInstance().getCurrentUser().getPhotoUrl()).
asBitmap().
into(-1,-1).
get();
} catch (final ExecutionException e) {
Log.e(TAG, e.getMessage());
} catch (final InterruptedException e) {
Log.e(TAG, e.getMessage());
}
return null;
}
@Override
protected void onPostExecute(Void dummy) {
if (null != theBitmap) {
// The full bitmap should be available here
image.setImageBitmap(theBitmap);
Log.d(TAG, "Image loaded");
};
}
}.execute();
drawer.addItem(new DrawerItem()
.setImage(this,theBitmap)
.setTextPrimary(getString(R.string.profile))
);
但它不加载图像,任何帮助将不胜感激以下为ImageView的图像加载代码
看到我的回答先生我希望这会帮助你。 –