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 <[email protected]> wrote:
> On Fri, Jul 23, 2010 at 5:59 PM, Nick Richardson <
> [email protected]> 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
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>
--
//Nick Richardson
//[email protected]
--
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
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en