In my app the pdf is downloaded on clicking the thumbnial and a progress indicator shows the downloaded progress, when the downloaded is completed a broadcast is fired from downloaded class and in main activity broadcast receiver is registered and adapter.notifyDataSetChanged(); acts. and the progress indicator goes invisible which is my requirement but My problem is this when the main activity goes to background and downloaded is completed the progress indicator does not go invisible. when user go back to the activity
BroadcastReceiver receiver=new BroadcastReceiver()
{
@Override
public void onReceive(Context context, Intent intent) {
adapter.notifyDataSetChanged();
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gridview);
new DownloadJSON().execute();
}
@Override
protected void onResume() {
super.onResume();
registerReceiver(receiver,new IntentFilter("com.download.complete"));
}
@Override
public void onStop() {
super.onStop();
unregisterReceiver(receiver);
//on completion of downloading pdf, broadcast is fired context.sendBroadcast(intent);