我試圖編寫一種方法將兩個微調器的值傳遞給另一個活動。傳遞微調器值
我在網上找到了使用putExtra方法的例子,但是我自己實現時遇到了問題(我想我只是不清楚它是如何工作的)。
我的代碼是(沒有在putExtra方法的任何值,因爲這是我卡上的位):
public void addListenerOnButton() {
transportSpinner = (Spinner) findViewById(R.id.transportSpinner);
locationSpinner = (Spinner) findViewById(R.id.locationSpinner);
buttonSubmit = (Button) findViewById(R.id.buttonSubmit);
buttonSubmit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(GetDirections.this.getApplicationContext(), DirectionDisplay.class);
i.putExtra();
GetDirections.this.startActivity(i);
}
});
}
感謝。
究竟是你想做些什麼?例如,你在「Intent」中包裝了什麼? – Phil
哪個適配器與微調器一起使用? – havexz