public void tellJoke(View view) { MainActivityFragment fragment = (MainActivityFragment) getSupportFragmentManager().findFragmentByTag(MAIN_FRAGMENT); fragment.enableProgressBar(); new JokeApiEndpointAsyncTask().execute(this); }
@Override protected void onRestart() { super.onRestart(); MainActivityFragment fragment = (MainActivityFragment) getSupportFragmentManager().findFragmentByTag(MAIN_FRAGMENT); fragment.disableProgressBar(); }
public void tellJoke(View view) { progressBar.setVisibility(View.VISIBLE); jokesAsyncTask = new JokesAsyncTask(this); jokesAsyncTask.execute(); if (fragment != null) { fragment.onCallFragment(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progressBar = (ProgressBar) findViewById(R.id.progressBar); fragment = (MainActivityFragment) getSupportFragmentManager().findFragmentById(R.id.fragment); fragment.setListener(this); }
public void tellJoke(View view) { MainActivityFragment fragment = (MainActivityFragment) getSupportFragmentManager().findFragmentById(R.id.fragment); fragment.showInterstitialAd(); }
@Override public void onResult(String joke) { this.joke = joke; fragment.onForceFinish(); }