title: How to sort String array Alphabetically in android?
body: <p>I know there are many solutions to this question, but I am still facing a error. I have a string array, and the data to the array is inserted through webservice .
  Below is my code.</p>
  
  <pre><code>protected void onPostExecute(String result) {
              dialog.dismiss();
              int dip = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                      (float) 1, getResources().getDisplayMetrics());
  
              JSONArray jarray;
  
              try {
                  jarray= new JSONArray(result);
                      name= new String[jarray.length()];
  for (int i=0;i&lt;jarray.length();i++){
  
                      JSONObject jobj = jarray.getJSONObject(i);
                  name[i]=    jobj.getString("Name");
  }
  </code></pre>
  
  <p>Now in name[i] I get the names ,but those are not arranged alphabetically. I tried Arrays.sort(name); but it is giving me null pointer.<img src="https://i.stack.imgur.com/M9KV1.png" alt="enter image description here"></p>