top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to receive json array from server?Android app development

+3 votes

I want to fetch details of particular objects inside my activity.How can I get it.

posted Mar 6, 2016 by Shivam Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Check the following code which receives the JSON array from the server for the given URL ( ) and returns the value of the error (Let me know if looking something different) -

public Boolean check_login(String url)
    DefaultHttpClient httpClient = new DefaultHttpClient();
    HttpEntity httpEntity = null;
    HttpResponse httpResponse = null;
    String response = null;
    JSONObject jsonObject;
    Boolean mylogin=false;

    HttpGet httpGet = new HttpGet(url);

    try {
        httpResponse = httpClient.execute(httpGet);

        httpEntity = httpResponse.getEntity();
        response = EntityUtils.toString(httpEntity);
    catch (UnsupportedEncodingException e) {
    } catch (ClientProtocolException e) {
    } catch (IOException e) {

    try {
        jsonObject = new JSONObject(response);
        mylogin = jsonObject.getBoolean("error");
    catch (JSONException e) {

    return mylogin;
answer Mar 7, 2016 by Salil Agrawal
Similar Questions
+2 votes

I want to send a json array to server,how I can achieve this?

+3 votes

how can install apk through ADB in android device.

+1 vote

I have a bunch of content (school text book type including images, equations, text, graphs etc ., that need to be made available for consumption on an Android App. Have tried doc parsing to JSON but it appears there are limitations of JSON (such as lack of adequate image support, support for special characters including math equations and so on.

Can someone recommend good, content publishing suite that allows delivery over mobile ? thanks Sridhar

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.