I am having a problem getting my list view based on retrieved data
from a database to show the full screen and scroll.  For some reason
neither the fill_parent or wrap_content values for my layout height
setting is being recognized. Right now my view only shows about a
quarter of the screen.  However, if I put in a hard codded number for
the height it works, but that is not a good solution because the user
can enter unlimited number of entries that could be displayed on the
list.   Without the hard coded size I can see that something is being
displayed behind the list for a couple seconds.  I am assuming it is
an error message but cannot figure out how to find out what it is
saying.

It worked correctly at one time but I cannot figure out what now is
preventing the screen from using the whole size with scrolling if
needed.  The code I use is below.

-----------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
     android:orientation="vertical"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     >
     <ListView
         android:id="@android:id/list"
         android:layout_width="fill_parent"
         android:layout_height="1600px" // tired "fill_parent" and
"wrap_content" as well
         android:padding="5px"/>
     <TextView android:id="@android:id/empty"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:gravity="center"
         android:text="No Locations Have Been Marked" />

 </LinearLayout>


<?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:background="#89B6FF" >

      <TextView android:id="@+id/loc_id"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textColor="#000000"
          android:text="LOC ID: "
          android:textStyle="bold" />

      <TextView android:id="@+id/display"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:textColor="#000000"/>

 </LinearLayout>


    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_selected);
    Criteria locationCriteria = new Criteria();

  locationCriteria.setAccuracy(Criteria.ACCURACY_FINE);
MapBack.loc_manager.requestLocationUpdates(MapBack.loc_manager.getBestProvider(locationCriteria,
true), 0, 0, MapBack.loc_listener);

        try
         {
          lv_err_msg = "Error creating DB Adapter";
          DBAdapter db = new DBAdapter(this);

          lv_err_msg = "Error retrieving DB Cursor";
          db.open();
          lv_cursor = db.getAllLocations();

          lv_err_msg = "Error starting Cursor Manager";
          startManagingCursor(lv_cursor);

          String[] from = new String[] { "loc_display" ,"_id" };
          int[] to = new int[] { R.id.display ,R.id.loc_id };

          lv_err_msg = "Error creating Simple Cursor Adapter";
          final SimpleCursorAdapter LocationList = new SimpleCursorAdapter
                                                          ( this
                                                           
,R.layout.main_selected_row
                                                           ,lv_cursor
                                                           ,from
                                                           ,to);

          lv_err_msg = "Error setting List Adapter";
          setListAdapter(LocationList);
          lv_err_msg = "Error setting up ArrayAdapter data set changed";
          lv_adapter = ((SimpleCursorAdapter)getListAdapter());
          db.close();

          int lv_height = LocationList.getCount() * 120;

          lv_err_msg = "Error setting up list Action Selections";
          ListView lv = getListView();
          lv.setOnItemClickListener(new AdapterView.OnItemClickListener()
           {
            public void onItemClick(AdapterView<?> av, View v, int pos, long
id)
             { show_action_list(LocationList,v,pos,id); }
            });
         }
    catch (Exception e)
     {
          AlertDialog.Builder DrawListAlertBox = new
AlertDialog.Builder(this);
          DrawListAlertBox.setMessage(lv_err_msg + " - " + e);
          DrawListAlertBox.setNeutralButton("OK", new
DialogInterface.OnClickListener() {
          public void onClick(DialogInterface arg0, int arg1) { } } );
          DrawListAlertBox.show();
     }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to