Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ,
Here is the section of the code , basically i am trying to make a meme sharing app :
Java
private void loadMeme()
{
    // Instantiate the RequestQueue.
    RequestQueue queue = Volley.newRequestQueue(this);
    String url ="https://meme-api.herokuapp.com/gimme";
    
    // Request a string response from the provided URL.
    JsonObjectRequest JsonObjectRequest = new JsonObjectRequest(Request.Method.GET, 
    url,(String)null,
    new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            String url = null;
            try {
                url = response.getString("url");
            } catch (JSONException e) {
                e.printStackTrace();
            }
            ImageView memeImageView = (ImageView) findViewById(R.id.memeImageView);
            Glide.with(this).load(url).into(memeImageView);
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
        }
    });

Glide.with(this).load(url).into(memeImageView); is the line which is showing this error message
Cannot resolve method 'with(anonymous com.android.volley.Response.Listener<org.json.JSONObject>)'

how to fix it

What I have tried:

I have used this in gradle to fix this :
compile 'com.github.bumptech.glide:glide:3.7.0'
Posted
Updated 16-Jun-21 6:32am
v2
Comments
Richard MacCutchan 13-Jan-21 7:07am    
What is Glide?
David Crow 13-Jan-21 9:54am    
Glide.with(this).load(url).into(memeImageView);
Should this be GlideApp instead?

compile 'com.github.bumptech.glide:glide:3.7.0'
Have you tried 4.11.0 instead?
Ronak kumawat 12-Jul-21 6:48am    
compile 'com.github.bumptech.glide:glide:3.7.0'

This is not working in my case.
Please help me

Glide.with(MainActivity.this).load(url).into(memeImageView);
// this will resolve your issue
 
Share this answer
 
use "getApplication()" instead of "this" within Glide.with()
 
Share this answer
 
Comments
Ronak kumawat 12-Jul-21 6:48am    
use "getApplication()" instead of "this" within Glide.with()

This is also not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900