title: SignUp form: inserting data into MySQL using Android 4.0
body: <p>Currently I'm developing a registration form for new user in Android (native app.) and by using .php file. By runnig the code I'm getting following error: "Unfortunately, application has stopped". I tried to change code in many ways to solve it, but without any result. Here is the php code:</p>
  
  <pre><code>&lt;?php 
  $dbcnx = @mysql_connect("localhost", "root", "root");
  $db = "dbname";
  mysql_select_db($db, $dbcnx);
  $user_id=$_POST['user'];
  $passwd=$_POST['passwd'];
  $query = 'INSERT INTO `users` VALUES (NULL, \''.$user_id.'\', \''.$passwd.'\')';
  $result = mysql_query($query) or die ("&lt;b&gt;Query failed:&lt;/b&gt; " . mysql_error());
  
  mysql_free_result($result);
  mysql_close($dbcnx);
  ?&gt;
  </code></pre>
  
  <p>And .java file:</p>
  
  <pre><code>import java.util.ArrayList;
  import org.apache.http.HttpResponse;
  import org.apache.http.NameValuePair;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.entity.UrlEncodedFormEntity;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.message.BasicNameValuePair;
  import org.apache.http.protocol.HTTP;
  import android.app.ListActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  
  public class Register extends ListActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.register);
  
      Button Insert=(Button)findViewById(R.id.send_button);
      Insert.setOnClickListener(new View.OnClickListener() {          
          public void onClick(View v) {
              // TODO Auto-generated method stub
              try {
                  EditText Text1=(EditText)findViewById(R.id.user_id);
                  EditText Text2=(EditText)findViewById(R.id.passwd);                 
  
                  ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
                  nameValuePairs.add(new BasicNameValuePair("user", ""+Text1.getText().toString()+""));
                  nameValuePairs.add(new BasicNameValuePair("passwd", ""+Text2.getText().toString()+""));
  
                  Log.e(""+Text1.getText().toString(),"0");
                  Log.e(""+Text2.getText().toString(),"0");
                  HttpClient httpclient = new DefaultHttpClient();
                  HttpPost httppost = new HttpPost("http://10.0.2.2/jku/user_reg.php");
                  httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
                  HttpResponse response = httpclient.execute(httppost);
              }
              catch(Exception e) {
                  Log.e("log_tag", "Error in http connection "+e.toString());
              }
  
          }
      });
  
  }   
  
  }
  </code></pre>
  
  <p>I fixated on my mistakes, so I'm beginner in android and any suggestions would be helpful.</p>
  
  <p>I've checked LogCat but nothing understand. So here is the log story:</p>
  
  <pre><code>01-04 21:37:13.275: D/gralloc_goldfish(552): Emulator without GPU emulation detected.
  01-04 21:37:13.345: W/TextLayoutCache(552): computeValuesWithHarfbuzz -- need to force to single run
  01-04 21:37:47.385: D/AndroidRuntime(552): Shutting down VM
  01-04 21:37:47.385: W/dalvikvm(552): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
  01-04 21:37:47.476: E/AndroidRuntime(552): FATAL EXCEPTION: main
  01-04 21:37:47.476: E/AndroidRuntime(552): java.lang.RuntimeException: Unable to start activity ComponentInfo{jku.project.kusss/jku.project.kusss.Register}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.os.Handler.dispatchMessage(Handler.java:99)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.os.Looper.loop(Looper.java:137)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.ActivityThread.main(ActivityThread.java:4340)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at java.lang.reflect.Method.invokeNative(Native Method)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at java.lang.reflect.Method.invoke(Method.java:511)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at dalvik.system.NativeStart.main(Native Method)
  01-04 21:37:47.476: E/AndroidRuntime(552): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.ListActivity.onContentChanged(ListActivity.java:243)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:254)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.Activity.setContentView(Activity.java:1835)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at jku.project.kusss.Register.onCreate(Register.java:27)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.Activity.performCreate(Activity.java:4465)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  01-04 21:37:47.476: E/AndroidRuntime(552):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
  01-04 21:37:47.476: E/AndroidRuntime(552):  ... 11 more
  </code></pre>