2010-12-04 195 views
1

請幫忙,我該怎麼處理這個錯誤?我在「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

回答

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

我認爲這是編譯時錯誤。你在兩行中打破了你的字符串(除非你顯示的列表正在被包裝)。如果你想要兩條線上的字符串,使它成爲兩個字符串 「這是開始」 +「,這是結束。」