I do an activation class in which authentication. I have an error:

Failed to read row 3, column -1 from a CursorWindow which has 10 rows, 3 columns. Failed to read row 3, column -1 from a CursorWindow which has 10 rows, 3 columns. .. .. .. Failed to read row 9, column -1 from a CursorWindow which has 10 rows, 3 columns.

Here is the activation code:

package com.example.dbapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import com.orm.SugarContext; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; public class MainActivity extends Activity implements OnClickListener { final String LOG_TAG = "myLogs"; Button btnAdd, btnRead, btnClear; Button backToInReg,register; EditText etName, etEmail; ArrayAdapter<Book> arrayAdapter; ListView listView; Book book = new Book(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnAdd = (Button) findViewById(R.id.log); btnAdd.setOnClickListener(this); etName = (EditText) findViewById(R.id.login); etEmail = (EditText) findViewById(R.id.password); register = (Button) findViewById(R.id.reg); register.setOnClickListener(this); listView = (ListView) findViewById(R.id.listView); List<Book> list = Book.listAll(Book.class); arrayAdapter = new ArrayAdapter<Book>(MainActivity.this,android.R.layout.simple_list_item_1,list); listView.setAdapter(arrayAdapter); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.log: String login = etName.getText().toString(); String password = etEmail.getText().toString(); List<Book> list = Book.listAll(Book.class); for(int i = 0;i<list.size();i++){ String ds = list.get(i).login; if(list.get(i).login==login && list.get(i).password==password){ Intent intent = new Intent(MainActivity.this,Activity_Registration.class); startActivity(intent); }else { Toast.makeText(getApplicationContext(),"Error! Login or password incorrect!",Toast.LENGTH_SHORT).show(); } } break; case R.id.reg: break; } } } 

Question: Do I check the login and password from the database correctly?

  • Try uninstalling the application and reinstalling. Or just clear the data in the settings. It looks like you have changed the structure of the database. And read how to compare strings in Java . - eugeneek
  • Yes, I did, but it did not help all the same - Eagamer Willy
  • Then add the full error in the question. - eugeneek

0