Your problem is not in AsyncTask.
In your onCreate(Bundle)
method you did not setContentView(int)
.
Assuming that your ProgressBar and MyCustomView are defined in your_activity_layout.xml resource file, you should add a line: setContentView(R.layout.your_activity_layout.xml)
.
Add it just after the call to super(Bundle)
constructor (you forgot to add it,too):
@Override
protected void onCreate(Bundle savedInstanceState) {
super(savedInstanceState);//you forgot that
setContentView(R.layout.your_activity_layout.xml);//and that
myProgressBar = (ProgressBar) findViewById(R.id.myProgressBar);
myCustomView = (MyCustomView) findViewById(R.id.myCustomView);
...
}
Now both of your View
s should be not null (if they present in xml layout file), and the above code should work.