title: Android studio getSlotFromBufferLocked: unknown buffer error
body: <p>I want to make a simple login and register app, so the user can create an account. (name, username, password)
  I use WAMP and a MYSQL database where I store the accounts.</p>
  
  <p>When I fill in the user info on the registration form and click register I get the following error:</p>
  
  <pre><code>09-14 09:30:39.864    2624-2638/com.example.appname.appname E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xab7115e0
  09-14 09:30:48.632    2624-2638/com.example.appname.appname E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xab7125a0
  09-14 09:30:51.940    2624-2638/com.example.appname.appname E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xab7125a0
  </code></pre>
  
  <p>When I go check the database it didn't store the account.</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
      public void userReg(View v)
      {
          startActivity(new Intent(this, Register.class));
      }
      public void userLogin(View view)
      {
  
  
      }
  
  
  }
  </code></pre>
  
  <p>Register.java</p>
  
  <pre><code>import android.app.Activity;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.EditText;
  
  public class Register extends Activity {
      EditText ET_NAME,ET_USER_NAME,ET_USER_PASS;
      String name,user_name,user_pass;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.register_layout);
          ET_NAME = (EditText) findViewById(R.id.name);
          ET_USER_NAME = (EditText) findViewById(R.id.new_user_name);
          ET_USER_PASS = (EditText) findViewById(R.id.new_user_pass);
      }
  
      public void userReg(View view)
      {
          name = ET_NAME.getText().toString();
          user_name = ET_USER_NAME.getText().toString();
          user_pass = ET_USER_PASS.getText().toString();
          String method = "register";
          BackgroundTask backgroundTask = new BackgroundTask(Register.this);
          backgroundTask.execute(method,name,user_name,user_pass);
          finish();
      }
  }
  </code></pre>
  
  <p>Backgroundtask.java</p>
  
  <pre><code>import android.app.AlertDialog;
  import android.content.Context;
  import android.os.AsyncTask;
  import android.widget.Toast;
  
  import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.OutputStream;
  import java.io.OutputStreamWriter;
  import java.net.HttpURLConnection;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.net.URLEncoder;
  
  public class BackgroundTask extends AsyncTask&lt;String, Void, String&gt; {
      AlertDialog alertDialog;
      Context ctx;
  
      BackgroundTask(Context ctx) {
          this.ctx = ctx;
  
      }
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
      }
  
      @Override
      protected String doInBackground(String... params) {
          String reg_url = "http://10.0.2.2.2/webapp/register.php";
          String login_url = "http://10.0.2.2.2/webapp/login.php";
          String method = params[0];
          if (method.equals("register")) {
              String name = params[1];
              String user_name = params[2];
              String user_pass = params[3];
              try {
                  URL url = new URL(reg_url);
                  HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
                  httpURLConnection.setRequestMethod("POST");
                  httpURLConnection.setDoOutput(true);
                  OutputStream OS = httpURLConnection.getOutputStream();
                  BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(OS, "UTF-8"));
                  String data = URLEncoder.encode("user", "UTF-8") + "=" + URLEncoder.encode(name, "UTF-8") + "&amp;" +
                          URLEncoder.encode("user_name", "UTF-8") + "=" + URLEncoder.encode(user_name, "UTF-8") + "&amp;" +
                          URLEncoder.encode("user_pass", "UTF-8") + "=" + URLEncoder.encode(user_pass, "UTF-8");
                  bufferedWriter.write(data);
                  bufferedWriter.flush();
                  bufferedWriter.close();
                  OS.close();
                  InputStream IS = httpURLConnection.getInputStream();
                  IS.close();
                  return "Registration Success...";
              } catch (MalformedURLException e) {
                  e.printStackTrace();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
  
          return null;
      }
  
      @Override
      protected void onProgressUpdate(Void... values) {
          super.onProgressUpdate(values);
      }
  
      @Override
      protected void onPostExecute(String result) {
          Toast.makeText(ctx, result, Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p>register.php</p>
  
  <pre><code>&lt;?php
  require "init.php";
  $name = $_POST["user"];
  $user_name = $_POST["user_name"];
  $user_pass = $_POST["user_pass"];
  
  $sql_query = "insert into user_info values('$name','$user_name','$user_pass');";
  
  if(mysqli_query($con,$sql_query))
  {
  //echo"&lt;h3&gt; Data insertion success...&lt;/h3&gt;";
  }
  else{
  //echo "Data insertion error..".mysqli_error($con);
  }
  
  
  
  ?&gt;
  </code></pre>
  
  <p>init.php</p>
  
  <pre><code>&lt;?php
  $db_name="myDBname";
  $mysql_user = "root";
  $mysql_pass = "root";
  $server_name="localhost";
  
  $con = mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name);
  if(!$con)
  {
  //echo"Connection Error".mysqli_connect_error();
  }
  else
  {
  //echo"&lt;h3&gt; Database connection success.....&lt;/h3&gt;";
  }
  
  
  ?&gt;
  </code></pre>