Android 您希望对棉花糖做哪些更改?有些内容在棉花糖中不起作用。有人能提供解决方案吗?
在内部Android 您希望对棉花糖做哪些更改?有些内容在棉花糖中不起作用。有人能提供解决方案吗?,android,sqlite,android-6.0-marshmallow,Android,Sqlite,Android 6.0 Marshmallow,在内部try catch阻止查询用户名是否在数据库中,是否在棉花糖中工作。但在较低版本中工作良好* View.OnClickListener adduserOnClickListener=new View.OnClickListener() { @Override public void onClick(View v) { try { fname=(EditText)findViewById(R.id.editTextFname); sname=(EditText)fi
try catch
阻止查询用户名是否在数据库中,是否在棉花糖中工作。但在较低版本中工作良好*
View.OnClickListener adduserOnClickListener=new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
fname=(EditText)findViewById(R.id.editTextFname);
sname=(EditText)findViewById(R.id.editTextsname);
email=(EditText)findViewById(R.id.editTextEmail);
code=(EditText)findViewById(R.id.editTextcode);
Uname=(EditText)findViewById(R.id.editTextuser);
pwrd=(EditText)findViewById(R.id.editTextpass);
//utype=(Spinner)findViewById(R.id.spinnerutype);
String fname1 = fname.getText().toString();
String lname1 = sname.getText().toString();
String email1 = email.getText().toString();
String code1 = code.getText().toString();
String uname1 = Uname.getText().toString();
String pswd1 = pwrd.getText().toString();
String utype1 = "admin";
if (fname1.equals("") {
Toast.makeText(getBaseContext(), "Enter First Name", Toast.LENGTH_LONG).show();
} else if (lname1.equals("") {
Toast.makeText(getBaseContext(), "Enter Second Name", Toast.LENGTH_LONG).show();
} else if (email1.equals("") {
Toast.makeText(getBaseContext(), "Enter Email Id ", Toast.LENGTH_LONG).show();
} else if (code1.equals("") {
Toast.makeText(getBaseContext(), "Enter Authentication Code ", Toast.LENGTH_LONG).show();
} else if (uname1.equals("") {
Toast.makeText(getBaseContext(), "Enter User Name", Toast.LENGTH_LONG).show();
} else if (pswd1.equals("") {
Toast.makeText(getBaseContext(), "Enter Password ", Toast.LENGTH_LONG).show();
}else {
Toast.makeText(getBaseContext(), "1" , Toast.LENGTH_LONG).show();
try
{
sqlitedatabase = openOrCreateDatabase(DatabaseName, Context.MODE_PRIVATE, null);
Cursor allrows1 = sqlitedatabase.rawQuery("SELECT * FROM "+UserConstruct.newUserinfo.TableName+" WHERE "+UserConstruct.newUserinfo.UserName+"=='"+uname1+"'", null);
System.out.println("COUNT : " + allrows1.getCount());
Toast.makeText(getBaseContext(), "COUNT : " + allrows1.getCount() , Toast.LENGTH_LONG).show();
if(allrows1.getCount()<=0)
{
exist= false;
}
Toast.makeText(getBaseContext(), "Entering", Toast.LENGTH_LONG).show();
allrows1.close();
dbhelper.close();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "",
Toast.LENGTH_LONG);
}
Toast.makeText(getBaseContext(), "3" , Toast.LENGTH_LONG).show();
if (exist) {
Toast.makeText(getBaseContext(), "This User Name not available", Toast.LENGTH_LONG).show();
} else {
dbhelper = new DatabaseHelper(context);
sqlitedatabase = dbhelper.getWritableDatabase();
dbhelper.insert(fname1, lname1, email1, code1, uname1, pswd1, utype1, sqlitedatabase);
Toast.makeText(getBaseContext(), "Data inserted", Toast.LENGTH_LONG).show();
dbhelper.close();
Registration.this.finish();
Intent intent = new Intent(Registration.this, LoginActivity.class);
startActivity(intent);
}
}
}catch (NullPointerException e){e.printStackTrace();}
}
};
View.OnClickListener adduserOnClickListener=newview.OnClickListener(){
@凌驾
公共void onClick(视图v){
试一试{
fname=(EditText)findViewById(R.id.editTextFname);
sname=(EditText)findviewbyd(R.id.editTextsname);
电子邮件=(EditText)findViewById(R.id.editTextEmail);
代码=(EditText)findViewById(R.id.editTextcode);
Uname=(EditText)findViewById(R.id.editTextuser);
pwrd=(EditText)findViewById(R.id.editTextpass);
//utype=(微调器)findViewById(R.id.spinnerutype);
字符串fname1=fname.getText().toString();
字符串lname1=sname.getText().toString();
字符串email1=email.getText().toString();
字符串code1=code.getText().toString();
字符串uname1=Uname.getText().toString();
字符串pswd1=pwrd.getText().toString();
字符串utype1=“admin”;
如果(fname1.等于(“”){
Toast.makeText(getBaseContext(),“输入名字”,Toast.LENGTH_LONG.show();
}else if(lname1.equals(“”){
Toast.makeText(getBaseContext(),“输入第二个名称”,Toast.LENGTH_LONG.show();
}else if(email1.equals(“”){
Toast.makeText(getBaseContext(),“输入电子邮件Id”,Toast.LENGTH_LONG.show();
}else if(代码1.等于(“”){
Toast.makeText(getBaseContext(),“输入身份验证代码”,Toast.LENGTH_LONG.show();
}else if(uname1.等于(“”){
Toast.makeText(getBaseContext(),“输入用户名”,Toast.LENGTH_LONG.show();
}else if(pswd1.equals(“”){
Toast.makeText(getBaseContext(),“输入密码”,Toast.LENGTH_LONG.show();
}否则{
Toast.makeText(getBaseContext(),“1”,Toast.LENGTH_LONG.show();
尝试
{
sqlitedatabase=openOrCreateDatabase(DatabaseName,Context.MODE_PRIVATE,null);
游标allrows1=sqlitedatabase.rawQuery(“从“+UserConstruct.newUserinfo.TableName+”中选择*,其中“+UserConstruct.newUserinfo.UserName+”==”+uname1+”,null);
System.out.println(“COUNT:+allrows1.getCount());
Toast.makeText(getBaseContext(),“COUNT:+allrows1.getCount(),Toast.LENGTH_LONG).show();
if(allrows1.getCount()marshmallow中到底发生了什么?“exist”没有改变。这是因为控件没有进入try-catch块。但在较低版本中工作。您在marshmallow中是否遇到任何异常?调试和检查没有异常。调试模式控件中没有问题进入该状态。只有在与已安装的控件一起使用时才会发生ted apk。marshmallow中到底发生了什么?“存在”没有改变。这是因为控件没有进入try-catch块。但在较低版本中工作。您在marshmallow中是否遇到任何异常?调试和检查没有异常。调试模式控件中没有问题进入该状态。它仅在与installe一起使用时才会发生d生成apk。