Am getting an error saying resource id can't be found tried tracing the problem the code seems fine
This area contains my class that uses the xml resource below to show all the necessary elements anyone who can help to tell me why am getting such an error
@Bind(R.id.showfirstname)
MyEditText Myfirstname;
@Bind(R.id.showlastname)
MyEditText Mylastname;
@Bind(R.id.showEmail)
MyEditText Myemail;
@Bind(R.id.profilephone)
MyEditText Mytel;
private Source mDataSource = new Source(this);
Cursor userDataCursor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_profile);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
ButterKnife.bind(this);
mDataSource.open();
userDataCursor = mDataSource.selectUserData();
userDataCursor.moveToFirst();
Myfirstname.setText(userDataCursor.getColumnIndex("firstname"));
Myfirstname.setEnabled(false);
Mylastname.setText(userDataCursor.getColumnIndex("lastname"));
Mylastname.setEnabled(false);
Myemail.setText(userDataCursor.getColumnIndex("email"));
Myemail.setEnabled(false);
Mytel.setText(userDataCursor.getColumnIndex("tel"));
Mytel.setEnabled(false);
mDataSource.close();
}
The getColumnIndex
method won't give you the value of that column. It only gives you the index of that column in your database.
You should do it like this:
userDataCursor.getString(userDataCursor.getColumnIndex("firstname"));