2014-10-29 127 views
-3

我已經開始了一點android開發,併爲我的第一個assigment,我決定做音板。我成功添加了幾個按鈕,並且他們在點擊時發出聲音。 目前當您打開應用程序時,它會直接打開Animal Soundboard。Android - onClick打開新窗口

我想下一步要做的是: 當你啓動應用程序,它爲您提供:

動物的叫聲 笑聲音 等等

當你點擊其中的一部分,所以它打開動物的聲音?

基本上我需要幫助,當你點擊按鈕打開新窗口的按鈕時如何編碼。

+0

這個網站是爲特定的只有問題,不是所有功能於一身的解決方案:http://stackoverflow.com/tour – Blacklight 2014-10-29 12:14:56

+0

http://stackoverflow.com/questions/736571/using-intent-in-an-android-application-to-show-another - 活動 – Naufal 2014-10-29 12:15:22

+1

先說你必須做的是通過這個http://developer.android.com/guide/index.html – Praveen 2014-10-29 12:15:52

回答

0

這個環節應該是有用的here

您要創建活動和按鈕後,啓動單擊

button.setOnClickListener(new OnClickListener() { 
@Override 
public void onClick(View v) { 
    Intent intent = new Intent(this, YourActivityName.class); 
    startActivity(intent); 
} 
}); 
+0

這就是我一直在尋找的,如何開始新的活動! – Sn1p3r 2014-10-29 18:51:23