私のアプリでスピナーとボタンを使用しようとしています。私は複数のインターフェイスを実装するための私の構文が正しいかどうかを知りたい。 onItemSelectedListenerため複数のインターフェイスをAndroidスタジオに実装する
public class MainActivity extends AppCompatActivity
implements View.OnClickListener, AdapterView.OnItemSelectedListener
マイ@Overrideも承認されない:これは、それが現在設定されている方法です。私は私が持っているもの投稿しますが、私はそこにエラーがないと私はそれがこの問題とは関係ありません信じているように私は、ボタンがクリックされた後に何が起こるかハンドル部分を省略します:
public class MainActivity extends AppCompatActivity
implements View.OnClickListener, AdapterView.OnItemSelectedListener {
Button setCountdown;
Spinner higestNotification;
EditText countdownTime;
int countdownConversion; //convert contents of countdownTime to an integer
int clockStart = 1;
int[] notificationTimes = new int[7];
String convertNotificationTimeToString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setCountdown = (Button) findViewById(R.id.setCountdown);
higestNotification = (Spinner) findViewById(R.id.highestNotification);
countdownTime = (EditText) findViewById(R.id.countdownTime);
setCountdown.setEnabled(false);//disable button at the start of the app
higestNotification.setEnabled(false);// disable spinner at the start of the app
countdownTime.setOnClickListener(this);
setCountdown.setOnClickListener(this);
higestNotification.setOnItemSelectedListener(this);
}
@Override
public void OnItemSelected(AdapterView<?> arg0, View arg1, int position, long id)
{
}
@Override
public void OnNothingSelected(AdapterView<?> arg0)
{
}
として私はOnItemSelected
あなたのオーバーライドされたメソッドは、小文字で始めるべき。コード内で指定されているので、メソッドのシグネチャはインタフェースと一致しません。 –
ありがとう!今私は馬鹿だと感じる – mrAnderson