title: Motion event has invalid pointer count 0; value must be between 1 and 16
body: <p>I was following this tutorial: <a href="http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/" rel="nofollow">http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/</a></p>
  
  <p>And made a login and registration screen.</p>
  
  <p><strong>The registration works propperly:</strong> </p>
  
  <p><a href="http://i.stack.imgur.com/8kBA6.png" rel="nofollow">users</a> </p>
  
  <p><strong>But when I want to login it doesn't work:</strong></p>
  
  <p>When i click the login button nothing shows up.</p>
  
  <p><em>Logcat:</em></p>
  
  <pre><code>06-05 14:29:59.545 1723-1896/? E/InputDispatcher: Motion event has invalid   pointer count 0; value must be between 1 and 16.
  06-05 14:29:59.635 1723-1896/? E/InputDispatcher: Motion event has invalid   pointer count 0; value must be between 1 and 16.
  </code></pre>
  
  <p><strong><em>Login:</em></strong></p>
  
  <p><em>Setup</em></p>
  
  <pre><code>    // Progress dialog
      pDialog = new ProgressDialog(getActivity());
      pDialog.setCancelable(false);
  
      // SQLite database handler
      db = new SQLiteHandler(getActivity().getApplicationContext());
  
      // Session manager
      session = new SessionManager(getActivity().getApplicationContext());
  
      // Check if user is already logged in or not
      if (session.isLoggedIn()) {
          // User is already logged in. Take him to main activity
          Intent intent = new Intent(getActivity(), MainActivity.class);
          startActivity(intent);
          getActivity().finish();
  
      loginButton.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View view) {
              String email = editTextEmail.getText().toString().trim();
              String password = editTextPassword.getText().toString().trim();
  
              // Check for empty data in the form
              if (!email.isEmpty() &amp;&amp; !password.isEmpty()) {
  
                  // login user
                  checkLoginEmail(email, password);
  
  
              } else {
                  // Prompt user to enter credentials
                  Toast.makeText(getActivity().getApplicationContext(),
                              "Please enter the credentials!", Toast.LENGTH_LONG)
                              .show();
                  }
              }
  
          });
  
  
  
      }
  </code></pre>
  
  <p><em>checkLoginEmail Method</em></p>
  
  <pre><code>   private void checkLoginEmail(final String email, final String password) {
      // Tag used to cancel the request
      String tag_string_req = "req_login";
  
      pDialog.setMessage("Logging in ...");
      showDialog();
  
      StringRequest strReq = new StringRequest(Request.Method.POST,
              AppConfig.URL_LOGIN, new Response.Listener&lt;String&gt;() {
  
          @Override
          public void onResponse(String response) {
              Log.d(TAG, "Login Response: " + response.toString());
              hideDialog();
  
              try {
                  JSONObject jObj = new JSONObject(response);
                  boolean error = jObj.getBoolean("error");
  
                  // Check for error node in json
                  if (!error) {
                      // user successfully logged in
                      // Create login session
                      session.setLogin(true);
  
                      // Now store the user in SQLite
                      String uid = jObj.getString("uid");
  
                      JSONObject user = jObj.getJSONObject("user");
                      String name = user.getString("name");
                      String email = user.getString("email");
                      String created_at = user
                              .getString("created_at");
  
                      // Inserting row in users table
                      db.addUser(name, email, uid, created_at);
  
                      // Launch main activity
                      Intent intent = new Intent(getActivity(),
                              MainActivity.class);
                      startActivity(intent);
                      getActivity().finish();
                  } else {
                      // Error in login. Get the error message
                      String errorMsg = jObj.getString("error_msg");
                      Toast.makeText(getActivity().getApplicationContext(),
                              errorMsg, Toast.LENGTH_LONG).show();
                  }
              } catch (JSONException e) {
                  // JSON error
                  e.printStackTrace();
                  Toast.makeText(getActivity().getApplicationContext(), "Json error: " + e.getMessage(), Toast.LENGTH_LONG).show();
              }
  
          }
      }, new Response.ErrorListener() {
  
          @Override
          public void onErrorResponse(VolleyError error) {
              Log.e(TAG, "Login Error: " + error.getMessage());
              Toast.makeText(getActivity().getApplicationContext(),
                      error.getMessage(), Toast.LENGTH_LONG).show();
              hideDialog();
          }
      }) {
  
          @Override
          protected Map&lt;String, String&gt; getParams() {
              // Posting parameters to login url
              Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
              params.put("email", email);
              params.put("password", password);
  
              return params;
          }
  
      };
  
      // Adding request to request queue
      AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
  }
  </code></pre>
  
  <p><em>Extra</em></p>
  
  <pre><code>    private void showDialog() {
      if (!pDialog.isShowing())
          pDialog.show();
  }
  
  private void hideDialog() {
      if (pDialog.isShowing())
          pDialog.dismiss();
  }
  </code></pre>
  
  <p><em>I made all that in a fragment.</em></p>
  
  <p><strong>SessionManager.java</strong></p>
  
  <pre><code>public class SessionManager {
  // LogCat tag
  private static String TAG = SessionManager.class.getSimpleName();
  
  // Shared Preferences
  SharedPreferences pref;
  
  Editor editor;
  Context _context;
  
  // Shared pref mode
  int PRIVATE_MODE = 0;
  
  // Shared preferences file name
  private static final String PREF_NAME = "AndroidHiveLogin";
  
  private static final String KEY_IS_LOGGEDIN = "isLoggedIn";
  
  public SessionManager(Context context) {
      this._context = context;
      pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
      editor = pref.edit();
  }
  
  public void setLogin(boolean isLoggedIn) {
  
      editor.putBoolean(KEY_IS_LOGGEDIN, isLoggedIn);
  
      // commit changes
      editor.commit();
  
      Log.d(TAG, "User login session modified!");
  }
  
  public boolean isLoggedIn(){
      return pref.getBoolean(KEY_IS_LOGGEDIN, false);
  }
  }
  </code></pre>