请帮忙,我该怎么办?我在“In Helper execution”中遇到错误,它说“字符串文字没有被双引号正确关闭。”
public class SMS extends Activity {
//
public static final String DEBUG_TAG = "FullDatabase Log";
public static final int DB_version = 2;
//public static final String DB_name = "User.db";
public static final String TABLE_NAME = "login";
//public static final String TABLE_NAME = "tbl_temp";
//public static final String DB_name = "User_temp";
public static final String DBNAME = "login";
public DatabaseHelper database_helper;
public SQLiteDatabase database;
public SQLiteDatabase database_rd;
/** Called when the activity is first created. */
public void onCreate1(Bundle savedInstanceState) {
super.onCreate1(savedInstanceState);
setContentView(R.layout.main);
Toast.makeText(this,"Before Bundled",
Toast.LENGTH_SHORT).show();
createDataBase();
//LogIn login = new LogIn();
Button submit = (Button)findViewById(R.id.widget71);
Toast.makeText(this,"after Bundled",
Toast.LENGTH_SHORT).show();
submit.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
SMS createaccount = new SMS();
Toast.makeText(createaccount.getApplicationContext(), "In Helper executing
onCreate1()", Toast.LENGTH_SHORT).show();
String[] success = insertRecords();
if(success[0].equalsIgnoreCase("1"))
{
Intent mIntent = new Intent(LogIn.this,DisplayUser.class);
mIntent.putExtra("username",success[1]);
mIntent.putExtra("retype",success[2]);
mIntent.putExtra("password",success[3]);
startActivity(mIntent);
}
}
});
//database.close();
}
答案 0 :(得分:2)
在java字符串中不能跨越多行。改变
Toast.makeText(createaccount.getApplicationContext(), "In Helper executing
onCreate1()", Toast.LENGTH_SHORT).show();
到
Toast.makeText(createaccount.getApplicationContext(), "In Helper executing onCreate1()", Toast.LENGTH_SHORT).show();
答案 1 :(得分:0)
我认为这是一个编译时错误。你把你的字符串分成两行(除非你显示的列表被包装)。如果你想要两行的字符串,请将其设为两个字符串 “这是一个开始” +“这就是结束。”