i'm following the example on the tutorial about the GridView, but instead of showing image, i want to just simple show some text using a TextView. it turns out seems to be harder than i thought. it might seems like this is totally unnecessary and it doesn't have a valid use case, but i'm trying this out to just get myself familiar with the sdk.
so my code is pretty much the same as the GridView example in http://developer.android.com/guide/tutorials/views/hello-gridview.html, but instead of using a ImageAdapter, i created a dummy adapter like following: class MyAdapter extends BaseAdapter { private Context context; private String[] texts = {"aaa", "bbb", "ccc", "ddd", "eee", "fff", "eee", "hhh", "iii"}; public MyAdapter(Context context) { this.context = context; } public int getCount() { return 9; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } public View getView(int position, View convertView, ViewGroup parent) { TextView tv; if (convertView == null) { tv = new TextView(context); tv.setLayoutParams(new GridView.LayoutParams(85, 85)); } else { tv = (TextView) convertView; } tv.setText(texts[position]); return tv; } it all seems valid to me, but running this gives me nothing on the screen. there's some selectable/clickable block if i click them, but the text is obvious not shown. i wonder is my layout doesn't have the android:text causing this problem? or anything else? any feedback will be appreciated and thanks for your help! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

