I have trouble displaying the layout of my main activity :
I create an ActivityA with an ImageView.
In onCreate(), I launch an AsyncTask, which retrieves content from Internet, and opens an ActivityB.
When I launch my application, it displays ActivityB right away.
public class ActivityA extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MyTask mytask = new MyTask();
mytask.execute();
}
}
My MainActivity xml file is the following :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/loadingPanel"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/home_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_home_page" />
<ProgressBar
android:id="@+id/marker_progress"
style="?android:attr/progressBarStyle"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical|center_horizontal"
android:indeterminate="true" />
</RelativeLayout>
The ProgressBar is used to show the loading process of the AsyncTask.
thanks for helping
Aucun commentaire:
Enregistrer un commentaire