Yes its for a list item. I will post the relevant code now.
Inside an Activity which happily extends ListActivity
onCreate() {
mCR = getContentResolver();
Cursor c = mCR
.query(mUri, null, null, null, GSProvider.COUNT + " DESC");
startManagingCursor(c);
mGCA = new GroupCursorAdapter(this, R.layout.group_detail_view, c);
setListAdapter(mGCA);
}
GroupCursorAdapter extends ResourceAdapter {
public void bindView(View view, Context context, Cursor cursor) {
String groupName = cursor.getString(GSProvider.NAME_INDEX);
ImageView image = (ImageView) view.findViewById(R.id.category_image
);
image.setImageResource(getDrawableForApp(groupName));
TextView name = (TextView) view.findViewById(R.id.name);
name.setText(groupName);
TextView count = (TextView) view.findViewById(R.id.online_users);
count.setText(cursor.getInt(GSProvider.COUNT_INDEX) + " users
online.")
}
}
Please let me know if you need something else.
Regards,
Harsh
On Sun, Mar 30, 2008 at 3:11 AM, Dan U. <[EMAIL PROTECTED]> wrote:
>
> From the title of your post, it looks like that xml is for a list
> item? Can you post more code? I can only get it to throw a null
> pointer exception.
>
> On Mar 29, 10:05 am, "Harsh Jain" <[EMAIL PROTECTED]> wrote:
> > bump...
> >
> > On Sat, Mar 29, 2008 at 7:48 AM, Harsh Jain <[EMAIL PROTECTED]> wrote:
> > > I had be really surprised. Can someone from google confirm ?
> >
> > > regards,
> > > harsh
> >
> > > On Sat, Mar 29, 2008 at 6:50 AM, [EMAIL PROTECTED] <
> [EMAIL PROTECTED]>
> > > wrote:
> >
> > > > Your xml looks ok, but I guess that the implementation of
> > > > RelativeLayout is buggy.
> >
> > > > On Mar 29, 1:18 am, "Harsh Jain" <[EMAIL PROTECTED]> wrote:
> > > > > Hi,
> > > > > I am having a tough time getting this simple layout to work.
> Please
> > > > advice.
> >
> > > > > What I need is something like this...
> > > > >
> ------------------------------------------------------------------
> > > > > | ###### |
> > > > > | ###### BIG TITLE |
> > > > > | ###### small message |
> > > > >
> --------------------------------------------------------------------
> > > > > |
> > > > > |
> >
> > > > > Here is how my xml file, Please let me know what's wrong.
> >
> > > > > <RelativeLayout xmlns:android="
> > > >http://schemas.android.com/apk/res/android"
> > > > > android:layout_width="fill_parent"
> > > > > android:layout_height="fill_parent">
> > > > > <ImageView android:id="@+id/category_image"
> > > > > android:layout_width="wrap_content"
> > > > > android:layout_height="wrap_content"
> > > > > android:layout_alignParentTop="true"
> > > > > android:layout_alignParentLeft="true"
> > > > > />
> > > > > <TextView android:id="@+id/name"
> > > > > android:layout_width="wrap_content"
> > > > > android:layout_height="wrap_content"
> > > > > android:textSize="25sp"
> > > > > android:layout_toRight="@id/category_image"
> > > > > android:layout_centerVertical="true"
> > > > > />
> > > > > <TextView android:id="@+id/users"
> > > > > android:layout_width="wrap_content"
> > > > > android:layout_height="wrap_content"
> > > > > android:layout_alignParentRight="true"
> > > > > android:layout_alignParentBottom="true"/>
> > > > > </RelativeLayout>
> >
> > > > > What I keep getting is the Big text move half up the top-line and
> the
> > > > small
> > > > > text goes top right.
> >
> > > > > Regards,
> > > > > Harsh
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---