2017-03-02 57 views
-7

嗨我是新的android應用程序開發項目,我已創建一個登錄屏幕,旨在儀表板avtivity。我在儀表板上做了一個按鈕來實現另一個活動,但是當我點擊按鈕而不是switchid ac時。它會崩潰並返回登錄屏幕。任何幫助將被讚賞。 這是我的意圖代碼。不切換到下一個活動

public class Dashboard extends AppCompatActivity { 
Button button; 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_dashboard); 

    button = (Button) findViewById(R.id.cv_btn); 

    button.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 

      Toast.makeText(Dashboard.this, "Make your CV easy", Toast.LENGTH_LONG).show(); 
      Intent cvintent; 
      cvintent= new Intent(Dashboard.this, CV.class); 
      startActivity(cvintent); 
     } 
    }); 
} 

}按鈕

<Button 
    android:id="@+id/cv_btn" 
    android:layout_width="150dp" 
    android:layout_height="wrap_content" 
    android:text="Make Your CV" 
    android:textColor="@android:color/white" 
    android:background="@color/colorPrimaryDark" 
    android:layout_margin="15dp" 
    android:textSize="16sp" 
    /> 
+1

你有沒有註冊清單文件,你的'CV'活動? – Piyush

+6

發佈您的錯誤代碼 –

+0

@suman粘貼您的崩潰日誌,而不是xml文件 –

回答

0

我跑那些你貼沒有任何問題,所有事情的來龍去脈正確的代碼

xml文件。我認爲你在CV活動或你的清單/構建配置中遇到了問題。

enter image description hereenter image description here