title: Null Pointer Exception in alert Dialog Builder
body: <p>In this method I used to call AlertDialog Box . But when I call the alert Dialog. I always get Fetal Exception . Below is the error i got in alert Dialog Builder . Help me finding please . </p>
  
  <pre><code>    12-18 04:25:10.222: E/AndroidRuntime(4173): FATAL EXCEPTION: main
      12-18 04:25:10.222: E/AndroidRuntime(4173): Process: com.androidexample.customlistview, PID: 4173
      12-18 04:25:10.222: E/AndroidRuntime(4173): java.lang.NullPointerException
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at android.app.AlertDialog.resolveDialogTheme          (AlertDialog.java:143)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at android.app.AlertDialog$Builder.&lt;init&gt;(AlertDialog.java:360)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at    com.androidexample.customlistview.CustomListViewAndroidExample.updateData  (CustomListViewAndroidExample.java:162)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at com.androidexample.customlistview.CustomAdapter$1.onClick(CustomAdapter.java:144)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at android.view.View.performClick(View.java:4424)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at android.view.View$PerformClick.run(View.java:18383)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at android.os.Handler.handleCallback(Handler.java:733)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at android.os.Handler.dispatchMessage(Handler.java:95)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at android.os.Looper.loop(Looper.java:137)         12-18 04:25:10.222: E/AndroidRuntime(4173):  at android.app.ActivityThread.main(ActivityThread.java:4998)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at java.lang.reflect.Method.invokeNative(Native Method)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at java.lang.reflect.Method.invoke(Method.java:515)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:593)
      12-18 04:25:10.222: E/AndroidRuntime(4173):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Here's is the Code :   </p>
  
  <pre><code> package com.androidexample.customlistview;
  
  import java.util.ArrayList;
  
  import org.apache.http.NameValuePair;
  import org.apache.http.message.BasicNameValuePair;
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  import android.os.Bundle;
  import android.os.StrictMode;
  import android.util.Log;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.res.Resources;
  
  
  public class CustomListViewAndroidExample extends Activity {
  
      ListView list;
      CustomAdapter adapter;
      String response = null;
      TextView txt_Date ;
      TextView txt_Location;
      static String teamID;
      static String startTime ;
  
      public  CustomListViewAndroidExample CustomListView = null;
      public  ArrayList&lt;String&gt; userIDArr = new ArrayList&lt;String&gt;();
      public  ArrayList&lt;ListModel&gt; CustomListViewArr = new ArrayList&lt;ListModel&gt;();
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          CustomListView = this;
          txt_Date = (TextView) findViewById(R.id.txt_date);
          txt_Location = (TextView) findViewById(R.id.txt_location);
          Intent intent= getIntent();
          startTime = intent.getStringExtra("startTime");
          txt_Location.setText(intent.getStringExtra("location"));
          teamID = intent.getStringExtra("teamID");
          txt_Date.setText(startTime);
          setListData();
          Resources res =getResources();
          list=(ListView)findViewById(R.id.participationList);
  
          adapter=new CustomAdapter(CustomListView, CustomListViewArr,res,userIDArr);
          list.setAdapter(adapter);
  
      }
  
  
      public void setListData()
      {
          StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
          .detectDiskReads().detectDiskWrites().detectNetwork()
          .penaltyLog().build());
  
          String userName = null;
          int memberStatus = 0;
          JSONArray memberData=null;
          int entry = 0;
          JSONObject jArray = null;
          String userID = null;
          String photo = null;
  
          ArrayList&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
          postParameters.add(new BasicNameValuePair("teamID",teamID));
          postParameters.add(new BasicNameValuePair("startTime","2013-09-18 10:00:00"));
  
  
          try {
  
              response = CustomHttpClient.executeHttpPost(
                     "http://10.0.2.2/football365/sankashaList.php",
                     postParameters);
  
              jArray = new JSONObject(response.toString());
              memberData=jArray.getJSONArray("memberdata");
  
              for(int i = 0 ; i &lt; memberData.length(); i++){
  
                  userName = (memberData.getJSONObject(i).getString("name").toString()+"\t");
                  memberStatus = Integer.parseInt(memberData.getJSONObject(i).getString("memberStatus").toString());
                  entry = Integer.parseInt(memberData.getJSONObject(i).getString("entry").toString());
                  photo = (memberData.getJSONObject(i).getString("photo").toString());
                  userID = (memberData.getJSONObject(i).getString("userID").toString());
                  Log.i("photo", photo);
                  userIDArr.add(i, userID);
  
  
                  ListModel sched = new ListModel();
                  sched.setMemberName(userName);
                  sched.setMemberStatus(memberStatus);
                    if(photo.equals("") || photo.equals(null))
                     {
                        sched.setImage("upload.png");
                     }
                     else{
                     sched.setImage(photo);
                     }
                     sched.setEntry(entry);
                     sched.setUserID(userID);
  
  
                  CustomListViewArr.add(sched);
              }
  
          }
  
  
          catch(JSONException e){
              Log.e("log_tag", "Error parsing data "+e.toString());
          }
          catch (Exception e) {
  
              Log.e("log_tag", "Error parsing data "+e.toString());
          }
  
             Log.i("AVCE", userName+"");
             Log.i("AVCE", memberStatus+"");
  
  
  
      }
  
      @SuppressWarnings("deprecation")
      public  void updateData(String userID,String entry) {
  
  
          StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
          .detectDiskReads().detectDiskWrites().detectNetwork()
          .penaltyLog().build());
  
          String response = null;
  
          ArrayList&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
          postParameters.add(new BasicNameValuePair("teamID",teamID));
          postParameters.add(new BasicNameValuePair("startTime",startTime));
          postParameters.add(new BasicNameValuePair("entry", entry));
          postParameters.add(new BasicNameValuePair("userID", userID));
  
          try {
              response = CustomHttpClient.executeHttpPost("http://10.0.2.2/football365/scheduleupdateflagentry.php",
                         postParameters);
          }
          catch (Exception e) {
  
              e.printStackTrace();
          }
          if(CustomHttpClient.response.getStatusLine().getStatusCode() == 400){
  
              if(response.toString().trim().equals("Insert Fail")){
                  AlertDialog.Builder alert = new AlertDialog.Builder(CustomListViewAndroidExample.this);
                  alert.setTitle("Error Logging in");
                  alert.setMessage("Insert Fail");
                  alert.setNeutralButton("Ok",new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
                          // TODO Auto-generated method stub
  
                      }
                  });
  
  
                alert.show();
  
              }
          }
  
  
          Log.i("response", response);
  
  
  
      }
  
  }
  </code></pre>