I'm beginner in Android Devloping, I have a trouble with UI in Android
I have a code look like this:
public class MainActivity extends Activity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv1 = (TextView) findViewById(R.id.textView1);
TextView tv2 = (TextView) findViewById(R.id.textView2);
tv1.setVisibility(View.GONE);
tv2.setVisibility(View.GONE);
String s="abc";
MyAsyncTask BkGroundTask = new MyAsyncTask();
BkGroundTask.execute(s);
try {
s = BkGroundTask.get();
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();}
tv1.setVisibility(View.VISIBLE);
tv2.setVisibility(View.VISIBLE);
}
}
But tv1 and tv2 do not disappear when AsyncTask is running. What should I do to fix this?