当前位置: 动力学知识库 > 问答 > 编程问答 >

android - spinner setOnItemSelectedListner trigger on create time of activity

问题描述:

when the activity has been created the spinner setOnItemSelectedListner() event is automatically call.

how to stop this automatic calling.

网友答案:
spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
    int count=0;
    @Override
    public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        if(count >= 1){
        //do something
        }
        count++;
    }

    @Override
    public void onNothingSelected(AdapterView<?> arg0) {
    }
});
分享给朋友:
您可能感兴趣的文章:
随机阅读: