MainActivity.java:
private class NetCheck extends AsyncTask<String, Void, Boolean> {
@Override
protected Boolean doInBackground(String... args) {
return cd.isConnectingToInternet();
}
protected void onPostExecute(Boolean th) {
if (th == true) {
new RemoteLoader(MainActivity.this).execute();
}
}
}
RemoteLoader.java:
public class RemoteLoader extends AsyncTask<Void, Void, Void>{
private View view;
public RemoteLoader(View context){
this.view = view;
}
@Override
protected Void doInBackground(Void... Pages) {
// do in bg
}
@Override
protected void onPostExecute(Void result) {
// Set title into TextView
TextView txttitle = (TextView) view.findViewById(R.id.txtProtip);
txttitle.setText(protip);
}
}
I'm trying to execute RemoteLoader
class from MainActivity
. But in RemoteLoader contains something that needs to inflate the Main layout.
How do I pass the Layout from MainActivity to RemoteLoader in this case?