Question

Trying to do the following (code is in the main activity):

private MenuItem mainMenuSync = null;

public void onCreate(Bundle savedInstanceState) {
  ...
  mainMenuSync = (MenuItem) findViewById(R.id.main_menu_sync);
}

private class Synchronize extends AsyncTask<Void, Void, Void> {
  ...

  @Override
  protected void onPreExecute() {
    mainMenuSync.setEnabled(false);
  }

But it fails. What I am doing wrong? (This menu item really starts this ASyncTask and I would like to avoid starting it again)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top