Load Data setOnItemSelectedListener

后端 未结 1 1315
眼角桃花
眼角桃花 2021-01-27 11:39

Problem: I load my class, the setOnItemSelectedListener function runs and sets variable wattage to a specific value, depending on what item was selected in th

相关标签:
1条回答
  • 2021-01-27 12:07

    Use the code below:

    // if false it means we're dealing with the initial selection so we should ignore it
    private boolean mFlag = false;
    
    mEdit.setOnItemSelectedListener(new OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
             if (!mFlag) {
                 // from this moment on the selection will be accepted
                 mFlag = true;
                 return;
             }
             // ...rest of code...
    
    0 讨论(0)
提交回复
热议问题