2017-08-01 67 views
0
mDriver = (Button) findViewById(R.id.driver); 
    mCustomer = (Button) findViewById(R.id.customer); 

誰能幫我...我得到不能解析符號「司機」不能解析符號「客戶」的上方。我如何解決這個問題?mDriver =(Button)findViewById(R.id.driver);

+0

安置自己的佈局代碼, –

+0

林completaly新本...這裏是佈局代碼? –

+0

在你的res/layout文件夾中。 –

回答

0
<Button 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="I'm a Driver" 
    android:id="@+id/Driver" /> 

<Button 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="I'm a Customer" 
    android:id="@+id/Customer" /> 

在佈局文件中的ID是:Driver & Customer但在你的代碼,你已經給driver & customer

檢查下面的代碼:

mDriver = (Button) findViewById(R.id.Driver); 
mCustomer = (Button) findViewById(R.id.Customer); 
+0

謝謝......這工作 –