I have an activity where the device checks for the latitude and longitude. After getting latitude and longitude I pass this information to a server which gets me nearest branches. But before I call the Location manager for getting latitude and longitude I call an Layout which has expandable list to fill up with getting data from server. But whenever the LocationManager is getting a fix of the satellite, lat and long, the layout does not render as I get black screen, till I get the data back from server I get black screen even in the phone. Let me know why is this screen appearing in between.
After I get back from server I get this usual screen with layout
this is part of my java code where I am calling layout first and then gps Location Manager and then hitting to the server to get branches list
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.findus_layout);
/*findUsProgressbarField = (ProgressBar)findViewById(R.id.findUsProgressBar);
findUsProgressbarField.setVisibility(View.VISIBLE);*/
mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
SharedPreferences findUsSetDetailsSharedPreference = getSharedPreferences("gpsdetails",MODE_PRIVATE);
String latitudeString = findUsSetDetailsSharedPreference.getString("latitude", "");
String longitudeString = findUsSetDetailsSharedPreference.getString("longitude", "");
try {
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("latitude", latitudeString));
postParameters.add(new BasicNameValuePair("longitude", longitudeString));
String response = CustomHttpClient.executeHttpPost("http://192.168.56.259:8080/StrutsExample/FindUS.slt",postParameters);
xml layout
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@drawable/white"
android:fillViewport="true"
android:tileMode="repeat" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/header"
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:background="@drawable/black"
android:tileMode="repeat">
<ImageButton
android:id="@+id/buttonBackFindUs"
android:src="@drawable/greenarrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/black"
android:tileMode="repeat"/>
<ImageView
android:src="@drawable/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
android:id="@+id/FindUsTextView"
android:fillViewport="true"
android:layout_marginTop="30dip"
android:layout_height="50dip"
android:layout_width="fill_parent"/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="80dip">
<ExpandableListView android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<TextView android:id="@+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/main_no_items"/>
</LinearLayout>
<LinearLayout
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:layout_weight="1"
android:weightSum="5"
android:orientation="horizontal"
android:background="@drawable/black"
android:tileMode="repeat">
<LinearLayout
android:layout_width="fill_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:layout_height="fill_parent">
<ImageButton
android:id="@+id/footerMainBtnHome"
android:layout_width="wrap_content"
android:layout_height="12dip"
android:src="@drawable/home"
android:background="@drawable/black"/>
<TextView
android:text="Home"
android:textSize="8dip"
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:layout_height="fill_parent">
<ImageButton
android:id="@+id/footerMainBtnProducts"
android:layout_width="wrap_content"
android:layout_height="12dip"
android:src="@drawable/products"
android:background="@drawable/black"/>
<TextView
android:text="Products"
android:textSize="8dip"
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:layout_height="fill_parent">
<ImageButton
android:id="@+id/footerMainBtnCart"
android:layout_width="wrap_content"
android:layout_height="12dip"
android:src="@drawable/cart"
android:background="@drawable/black"/>
<TextView
android:text="Cart"
android:textSize="8dip"
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:layout_height="fill_parent">
<ImageButton
android:id="@+id/footerMainBtnFeedback"
android:layout_width="wrap_content"
android:layout_height="12dip"
android:src="@drawable/feedback"
android:background="@drawable/black"/>
<TextView
android:text="Feedback"
android:textSize="8dip"
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:layout_height="fill_parent">
<ImageButton
android:id="@+id/footerMainBtnHelp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/help"
android:background="@drawable/black"/>
<TextView
android:text="Help"
android:textSize="8dip"
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
Could let me know what would be the problem. Looking for your reply. thanks.