🔒 Closed Android studio, how to fetch image from mysql database

Status
Not open for further replies.

binary69

Fanatic
good day ma'am/sir
I need some help of how to fetch the image from database and display it to my ImageView

private void getSqlDetails() {
final String url= "You do not have permission to view the full content of this post. Log in or register now."+getUser;
pd.show();
StringRequest stringRequest = new StringRequest(Request.Method.GET,
url,
new Response.Listener<String>() {
Override
public void onResponse(String response) {
pd.hide();
try {

JSONArray jsonarray = new JSONArray(response);
for(int i=0; i < jsonarray.length(); i++) {
JSONObject jsonobject = jsonarray.getJSONObject(i);
String name=jsonobject.getString("image_name");
String imageURL=jsonobject.getString("image_path");
result.setText(name);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
Override
public void onErrorResponse(VolleyError error) {
if(error != null){

//Never mind this below
// Toast.makeText(getApplicationContext(), "Something went wrong.", Toast.LENGTH_LONG).show();
}
}
}

);
 
Status
Not open for further replies.

About this Thread

  • 0
    Replies
  • 709
    Views
  • 1
    Participants
Last reply from:
binary69

Trending Topics

Online now

Members online
819
Guests online
660
Total visitors
1,479

Forum statistics

Threads
2,279,442
Posts
28,990,737
Members
1,225,914
Latest member
joh62
Back
Top