Advertisement
vitareinforce

load image using glide

Apr 15th, 2019
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public class DetailActivity extends AppCompatActivity {
  2. private ImageView fotoBukti;
  3. @Override
  4. protected void onCreate(Bundle savedInstanceState) {
  5. super.onCreate(savedInstanceState);
  6. setContentView(R.layout.activity_detail);
  7.  
  8. fotoBukti = (ImageView) findViewById(R.id.imgPreviewDetail);
  9.  
  10. LazyHeaders auth = new LazyHeaders.Builder() // can be cached in a field and reused
  11. .addHeader("Authorization", new BasicAuthorization("username", "password"))
  12. .build();
  13.  
  14. imageSrc = extras.getString("IMAGE");
  15.  
  16. imageLink = "http://bawaslu-ftp.pptik.id:5000/" + imageSrc;
  17.  
  18. Glide
  19. .with(getApplicationContext())
  20. .load(new GlideUrl(imageLink, auth)) // GlideUrl is created anyway so there's no extra objects allocated
  21. .into(fotoBukti);
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement