Otherwise you can also add this:
scheduleList.setEmptyView(findViewById(android.R.id.empty));

On Sat, Jul 24, 2010 at 11:06 AM, YuviDroid <yuvidr...@gmail.com> wrote:

> Maybe it's stupid to ask....but just to make sure, does your activity
> extend ListActivity? (maybe it has nothing to do with your problem....dunno
> hehe)
>
>
> On Sat, Jul 24, 2010 at 7:50 AM, Nick Richardson <
> richardson.n...@gmail.com> wrote:
>
>> Thanks for the reply Tre.  I made the changes to the id's like you
>> suggested - the TextView is still displayed even when the ListView has data
>> in it.  This is very frustrating :S
>>
>> Updated layout snippet:
>>
>>     <ListView android:id="@id/android:list"
>>               android:layout_width="fill_parent"
>>   android:layout_height="fill_parent"
>>       android:textAppearance="?android:attr/textAppearanceMedium"
>>   android:gravity="center_vertical"
>>   android:layout_weight="1"
>>   android:paddingLeft="6dip"
>>   android:paddingRight="6dip"
>>               android:layout_below="@id/text_main_instructions"
>>               android:drawSelectorOnTop="false"/>
>>
>>   <TextView android:id="@+id/android:empty"
>>   android:layout_width="fill_parent"
>>   android:layout_height="wrap_content"
>>   android:textAppearance="?android:attr/textAppearanceMedium"
>>   android:gravity="center_vertical|center_horizontal"
>>   android:paddingLeft="6dip"
>>   android:paddingRight="6dip"
>>            android:text="@string/main_schedule_empty"
>>   android:layout_below="@id/text_main_instructions"/>
>> ......
>>
>> Just in case i'm doing something complete stupid, here's the code i'm
>> using to populate the ListView.  Note that i'm manually adding strings to be
>> displayed for testing right now.
>>
>> ListView scheduleList = (ListView)parent.findViewById(android.R.id.list);
>>
>>      scheduleList_ar.add("asdf");
>>      scheduleList_ar.add("WTF huh??");
>>
>>      scheduleList.setTextFilterEnabled(true);
>>      scheduleList.setAdapter(new ArrayAdapter<String>(parent,
>> android.R.layout.simple_list_item_1, scheduleList_ar));
>>
>>     scheduleList.setOnItemClickListener(new OnItemClickListener() {
>>      @Override
>>      public void onItemClick(AdapterView<?> a, View v, int position, long
>> id)
>>      Intent scheduleOptionsActivity = new Intent(parent.getBaseContext(),
>> ScheduleOptions.class);
>>      scheduleOptionsActivity.putExtra("scheduleId",
>> scheduleList_ar.get(position));
>>      parent.startActivity(scheduleOptionsActivity);
>>      }
>>      });
>>
>> Thanks again for any help!
>> //Nick
>>
>> On Fri, Jul 23, 2010 at 9:20 PM, TreKing <treking...@gmail.com> wrote:
>>
>>> On Fri, Jul 23, 2010 at 5:59 PM, Nick Richardson <
>>> richardson.n...@gmail.com> wrote:
>>>
>>>> Is there something i have to call in code to make this work?  What am i
>>>> doing wrong?
>>>>
>>>
>>> I have @id/android:list (no '+') and @+id/android:empty (yes '+') and it
>>> works for me. Maybe that's it?
>>>
>>> Also, does my ListView have to have the id "@id/android:list" in order
>>>> for this to work, or can i give it a different id?
>>>>
>>>
>>> It does if you're using it in a ListActivity. Otherwise, no.
>>>
>>>
>>> -------------------------------------------------------------------------------------------------
>>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>>> transit tracking app for Android-powered devices
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Beginners" group.
>>>
>>> NEW! Try asking and tagging your question on Stack Overflow at
>>> http://stackoverflow.com/questions/tagged/android
>>>
>>> To unsubscribe from this group, send email to
>>> android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-beginners?hl=en
>>>
>>
>>
>>
>> --
>> //Nick Richardson
>> //richardson.n...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Beginners" group.
>>
>> NEW! Try asking and tagging your question on Stack Overflow at
>> http://stackoverflow.com/questions/tagged/android
>>
>> To unsubscribe from this group, send email to
>> android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/group/android-beginners?hl=en
>>
>
>
>
> --
> YuviDroid
> Check out Launch-X <http://android.yuvalsharon.net/launchx.php> (a widget
> to quickly access your favorite apps and contacts!)
> http://android.yuvalsharon.net
>
>


-- 
YuviDroid
Check out Launch-X <http://android.yuvalsharon.net/launchx.php> (a widget to
quickly access your favorite apps and contacts!)
http://android.yuvalsharon.net

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to