title: How to Bind Json Data into Mpandroid Bar Chart in Android?
body: <p>Json Data:</p>
  
  <pre><code>[
  {
    "NAME":"601 GRIETA EN CUERPO",
    "PERCENTAGE":"46"
  },
  {
    "NAME":"77 ENFRIAMIENTO O DUNTING",
    "PERCENTAGE":"18"
  },
  {
    "NAME":"78 PRECALENTAMIENTO",
    "PERCENTAGE":"18"
  },
  {
    "NAME":"209 MAL MANEJO",
    "PERCENTAGE":"9"
  },
  {
    "NAME":"92 FUGA DE MANOMETRO",
    "PERCENTAGE":"9"
  }
  ]
  </code></pre>
  
  <p>Bar Chart.Java</p>
  
  <pre><code>import android.app.ProgressDialog;
  import android.content.DialogInterface;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.support.v7.app.AlertDialog;
  import android.support.v7.app.AppCompatActivity;
  import android.util.Log;
  import android.view.ContextMenu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.ListAdapter;
  import android.widget.ListView;
  import android.widget.SimpleAdapter;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.github.mikephil.charting.charts.BarChart;
  import com.github.mikephil.charting.data.BarData;
  import com.github.mikephil.charting.data.BarDataSet;
  import com.github.mikephil.charting.data.BarEntry;
  import com.github.mikephil.charting.utils.ColorTemplate;
  
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  public class barchart extends AppCompatActivity  {
  
      BarChart chart ;
      ArrayList&lt;BarEntry&gt; BARENTRY ;
      ArrayList&lt;String&gt; BarEntryLabels ;
      BarDataSet Bardataset ;
      BarData BARDATA ;
  
      private String TAG = MainActivity.class.getSimpleName();
  
      private ProgressDialog pDialog;
   private static String url = "http://113.193.30.155/MobileService/MobileService.asmx/GetSampleData";
  protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.bar_chart);
  
  new GetContacts().execute();
  
  //        bar chart
  
          chart = (BarChart) findViewById(R.id.barchart);
  }
   private class GetContacts extends AsyncTask&lt;Void, Void, Void&gt; {
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              // Showing progress dialog
              pDialog = new ProgressDialog(barchart.this);
              pDialog.setMessage("Please wait...");
              pDialog.setCancelable(false);
              pDialog.show();
  
          }
  
          @Override
          protected Void doInBackground(Void... arg0) {
              HttpHandler sh = new HttpHandler();
  
              // Making a request to url and getting response
              String jsonStr = sh.makeServiceCall(url);
  
              Log.e(TAG, "Response from url: " + jsonStr);
  
              if (jsonStr != null) {
                  try {
  
                      JSONArray array = new JSONArray(jsonStr);
                      for (int i = 0; i &lt; array.length(); i++) {
                          JSONObject object = (JSONObject) array.get(i);
  
                          String NAME = object.getString("NAME");
                          String PERCENTAGE = object.getString("PERCENTAGE");
  
  
  
  
                      }
  
                  } catch (final JSONException e) {
                      Log.e(TAG, "Json parsing error: " + e.getMessage());
                      runOnUiThread(new Runnable() {
                          @Override
                          public void run() {
                              Toast.makeText(getApplicationContext(),
                                      "Json parsing error: " + e.getMessage(),
                                      Toast.LENGTH_LONG)
                                      .show();
                          }
                      });
  
                  }
              } else {
                  Log.e(TAG, "Couldn't get json from server.");
                  runOnUiThread(new Runnable() {
                      @Override
                      public void run() {
                          Toast.makeText(getApplicationContext(),
                                  "Couldn't get json from server. Check LogCat for possible errors!",
                                  Toast.LENGTH_LONG)
                                  .show();
                      }
                  });
  
              }
  
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result) {
              super.onPostExecute(result);
              // Dismiss the progress dialog
              if (pDialog.isShowing())
                  pDialog.dismiss();
  
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>Help me to bind <code>JSON</code> data into bar chart in android. Thanks in advance.</p>