Displaying data using TableLayout

by ramesh kumar bh » Tue, 14 Apr 2009 01:00:04 GMT

Sponsored Links
i have retrieved some information from database using Android
I want to display this data via a table format in my application.
I have used TextView in tableRow to display the data. But how this
dynamic data has to be presented.
Please help me as i am new to this Android.
Ramesh Kumar Bhamidipati


Other Threads

1. Click event on Edit-Text's Right Drawable.

Hello Developers,

I have one Edit Text with right drawable.
The xml code is

<TextView android:id="@+id/trip_txt_to"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/addname" android:layout_alignParentLeft="true"
android:textStyle="bold" android:textColor="@color/black"
android:typeface="normal" android:padding="10dp"
android:layout_below="@+id/lineview1" />

android:id="@+id/nameofpersonr" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/name" android:textColor="@color/black"

<ImageView android:id="@+id/clearnameimage"
android:layout_alignParentRight="true" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:scaleType="fitXY"
android:src="@drawable/deleteicon" android:padding="5dp"/>

and CustomEditTextActivity.java

public class CustomEditTextActivity extends EditText {
private Drawable rightSideDrawable;
private Rect rectangleBounds;

public CustomEditTextActivity(Context context, AttributeSet attributeSet,
int defStyle) {

super(context, attributeSet, defStyle);

public CustomEditTextActivity(Context context, AttributeSet attributeSet) {
super(context, attributeSet);

public CustomEditTextActivity(Context context) {

public void setCompoundDrawables(Drawable left, Drawable top,
Drawable right, Drawable bottom) {
if (right != null) {
rightSideDrawable = right;
super.setCompoundDrawables(left, top, right, bottom);

protected void finalize() throws Throwable {
rightSideDrawable = null;
rectangleBounds = null;

public Rect getRectBound() {
return rectangleBounds;

public Drawable getRightDrawable() {
return rightSideDrawable;
          // on touch event code i got from some site..
    public boolean onTouchEvent(MotionEvent event)

        if(event.getAction() == MotionEvent.ACTION_UP &&
         rectangleBounds = rightSideDrawable.getBounds();
            final int x = (int)event.getX();
            final int y = (int)event.getY();

            if(x>=(this.getRight()-rectangleBounds.width()) &&
                    && y>=this.getPaddingTop() &&
                event.setAction(MotionEvent.ACTION_CANCEL);//use this to
prevent the keyboard from coming up
        return super.onTouchEvent(event);


Now problem is,

when i open the activity, it shows me keyboard and i can right in edit text,
but as soon as i touch to edit text it launches another activity, i called
it "InfoActivity.java". But InfoActivity.java is supposed to be launched if
I click on drawable not on edit text.
Can you please help me to get click event or touch event on right hand side
drawable, instead of edit text? or is there any other alternative way?
Also, because of this i can not use this line for keyboard..


Can anyone help me in that? I have made lots of changes in ontouch event
written above but fail.

So please help me in that. I really appreciate it. Thank you in advance.


2. Layout related

How to add buttons that sticks to the bottom of  layout and rest part of
layout is scrollable (Same as add event of calendar)?


3. Syntax to reference a drawable from a library project

4. monkeyrunner with different android versions

5. DalvikVm issue

6. ASK : signal motorola xt720 sering hilang

7. Help for installig android sdk tool