What's new

Closed Android studio, how to fetch image from mysql database

Status
Not open for further replies.

binary69

Honorary Poster
Joined
Apr 13, 2016
Posts
193
Reaction
35
Points
141
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.

Similar threads

Back
Top