I use a checkbox in my app as a button turn something on or off. But the action (load a file from the network) is done in an async task so I don't want the check to come on until the async task finishes successfully, like this
protected void onPostExecute(String result) {
if(result==null) {
return;
}
// loaded ok, turn on check mark
MainActivity.mMp3Cb.setChecked(true);
The problem is, setChecked(true)
causes OnCheckedChangeListener
to fire again as if it were user input
Is there a way to avoid this? or at least detect it in onCheckedChanged
?
thanks