By passing activity object to the constructor of the AsyncTask. Is there any possibility of Activity leaking. if so then how it happen, can anyone please explain this. and how to avoid the activity leaking if it happening.
public class RemoteLoader extends AsyncTask<Void, Void, Void> {
private Activity activity;
public RemoteLoader(Activity context){
this.activity = context;
}
@Override
protected Void doInBackground(Void... Pages) {
// do in bg
}
@Override
protected void onPostExecute(Void result) {
// Set title into TextView
TextView txttitle = (TextView)activity.findViewById(R.id.txtProtip);
txttitle.setText(protip);
}
}