title: error when posting to mysql from android
body: <p>im new to android programming, iv been trying to connect to a remote server and post the data into a mysql database, my code runs fine but when i click on the button to post into database, the app crashes and gives the error "unfortunately the app has stopped working", but when i check the db, the data has been inserted.
  can someone please look at the code and tell me why the app is crashing and probably rectify it. </p>
  
  <p>my xml code
      
      </p>
  
  <pre><code>    &lt;!-- Name Label --&gt;
      &lt;TextView android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Product Name"
          android:paddingLeft="10dip"
          android:paddingRight="10dip"
          android:paddingTop="10dip"
          android:textSize="17dip"/&gt;
  
      &lt;!-- Input Name --&gt;
      &lt;EditText android:id="@+id/inputName"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_margin="5dip"
          android:layout_marginBottom="15dip"
          android:singleLine="true"/&gt;
  
      &lt;!-- Price Label --&gt;
      &lt;TextView android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Price"
          android:paddingLeft="10dip"
          android:paddingRight="10dip"
          android:paddingTop="10dip"
          android:textSize="17dip"/&gt;
  
      &lt;!-- Input Price --&gt;
      &lt;EditText android:id="@+id/inputPrice"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_margin="5dip"
          android:layout_marginBottom="15dip"
          android:singleLine="true"
          android:inputType="numberDecimal"/&gt;
  
      &lt;!-- Description Label --&gt;
      &lt;TextView android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Description"
          android:paddingLeft="10dip"
          android:paddingRight="10dip"
          android:paddingTop="10dip"
          android:textSize="17dip"/&gt;
  
      &lt;!-- Input description --&gt;
      &lt;EditText android:id="@+id/inputDesc"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_margin="5dip"
          android:layout_marginBottom="15dip"
          android:lines="4"
          android:gravity="top"/&gt;
  
      &lt;!-- Button Create Product --&gt;
          &lt;Button android:id="@+id/btnCreateProduct"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Create Product"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>my java file</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  import org.apache.http.NameValuePair;
  import org.apache.http.message.BasicNameValuePair;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  
  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  public class NewProduct extends Activity {
  
      // Progress Dialog
      private ProgressDialog pDialog;
  
      JSONParser jsonParser = new JSONParser();
      EditText inputName;
      EditText inputPrice;
      EditText inputDesc;
  
  
      private static String url_create_product =    "http:////bsa.co.ke/androidconnect/create_product.php";   
  
      // JSON Node names
      private static final String TAG_SUCCESS = "success";
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_new_product);
  
         // Edit Text
          inputName = (EditText) findViewById(R.id.inputName);
          inputPrice = (EditText) findViewById(R.id.inputPrice);
          inputDesc = (EditText) findViewById(R.id.inputDesc);
  
          // Create button
          Button btnCreateProduct = (Button) findViewById(R.id.btnCreateProduct);
  
          // button click event
          btnCreateProduct.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View view) {
                  // creating new product in background thread
                  new CreateNewProduct().execute();
              }
          });
      }
  
      /**
       * Background Async Task to Create new product
       * */
      class CreateNewProduct extends AsyncTask&lt;String, String, String&gt; {
  
          /**
           * Before starting background thread Show Progress Dialog
           * */
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              pDialog = new ProgressDialog(NewProduct.this);
              pDialog.setMessage("Creating Product..");
              pDialog.setIndeterminate(false);
              pDialog.setCancelable(true);
              pDialog.show();
         }
  
          /**
           * Creating product
           * */
          protected String doInBackground(String... args) {
              String name = inputName.getText().toString();
              String price = inputPrice.getText().toString();
              String description = inputDesc.getText().toString();
  
              // Building Parameters
              List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
              params.add(new BasicNameValuePair("name", name));
              params.add(new BasicNameValuePair("price", price));
              params.add(new BasicNameValuePair("description", description));
  
              // getting JSON Object
              // Note that create product url accepts POST method
              JSONObject json = jsonParser.makeHttpRequest(url_create_product,
                      "POST", params);
  
              // check log cat from response
              Log.d("Create Response", json.toString());
  
              // check for success tag
              try {
                  int success = json.getInt(TAG_SUCCESS);
  
                  if (success == 1) {
                      // successfully created product
                      Toast.makeText(NewProduct.this,
                              "Success", Toast.LENGTH_LONG)
                              .show();
  
  
                      // closing this screen
                      finish();
                  } else {
                      // failed to create product
                  }
              } catch (JSONException e) {
                  e.printStackTrace();
              }
  
              return null;
          }
  
          /**
           * After completing background task Dismiss the progress dialog
           * **/
          protected void onPostExecute(String file_url) {
              // dismiss the dialog once done
              pDialog.dismiss();
          }
  
      }
  }
  </code></pre>