字符串文字不正确执行

问题描述:

请帮忙,我该怎么处理这个错误?我在“Helper执行中”出错,它说“字符串文字没有通过双引号正确关闭”。字符串文字不正确执行

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(); 
} 
+3

请正确格式的代码,并显示真正的错误信息 - 不要套用。 – 2010-12-04 23:15:28

+2

向我们展示堆栈跟踪。 – 2010-12-04 23:32:03

在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(); 

我认为这是编译时错误。你在两行中打破了你的字符串(除非你显示的列表正在被包装)。如果你想要两条线上的字符串,使它成为两个字符串 “这是开始” +“,这是结束。”