Template ROW using xml and api

by Raja Nagendra Kumar » Sat, 02 May 2009 22:54:46 GMT


Sponsored Links
 Hi,

We have a table which may have infinite rows. Would it be possible to
create row by using the xml template say

<TableRow>
            <EditText android:id="@+id/tbRelation"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:singleLine="true"
                      android:scrollHorizontally="true"
                      android:textSize="20sp"/>
            <Button android:id="@+id/bRelationQuery"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/blQuery"/>
        </TableRow>


some thing similar to clone of existing row but with different id's
etc.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
--~--~---------~--~----~------------~-------~--~----~



Template ROW using xml and api

by Mark Murphy » Sun, 03 May 2009 02:29:42 GMT


 


Unless you have a device with infinite RAM, your table will have finite
rows.


Yes and no.

Yes, you should be able to inflate an XML file for a TableRow and use
addView() or something to append it to a TableLayout.

No, by default, each inflated row's elements will have the same IDs as
those in every other row. You would need to call setId() on each View
that needs its own ID, supplying some unique value.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, $35/Year

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Template ROW using xml and api

by Romain Guy » Sun, 03 May 2009 03:12:56 GMT


 A table with an "infinite" number of rows would be better implemented
as a ListView.







-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~



Template ROW using xml and api

by Raja Nagendra Kumar » Mon, 04 May 2009 14:40:12 GMT


 Hi Mark,

Thank you for details.. In the interest of others these are the code
level details we have done..

1. We have One main xml with tablelayout
2. Another  layout xml with table row specification

We every time we need to add a new row to the table, we inflate the
row xml and and find the id's, add the respective listeners.. detatch
the row from the inflated overall view and add to first views table.
Code for this is below.

addRow()
{
TableLayout tl = (TableLayout) getActivity().findViewById(R.id.table);

        LayoutInflater inflater = (LayoutInflater) (getActivity
()).getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
        LinearLayout v = (LinearLayout) inflater.inflate
(R.layout.dial_relation_infate_row,
                                                         null,
                                                         false);

        TableRow lableRow = (TableRow) v.findViewById(R.id.labelRow);
        TextView lableField = (TextView) v.findViewById(R.id.labelField);
        v.removeView(lableRow);
        tl.addView(lableRow);
        labelRows.add(lableRow);

        TableRow fieldRow = (TableRow) v.findViewById(R.id.fieldRow);
        Button fieldButton = (Button) v.findViewById(R.id.fieldButton);
        fieldButton.setTag(dataRows.size());
        fieldButton.setOnClickListener(this);

        v.removeView(fieldRow);
        tl.addView(fieldRow);
}

Android power is in this approach to writ powerful ui with ease.

Mark, one observation regarding the id's that different rows coudl
have the same id and one could get row specific component could be
found by asking the view to find the component. This has made us not
to change the id's too.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Titipan Lowongan Kerja untuk Tabulet PC

Dear all,

Ada titipan lowongan pekerjaan nih buat jadi programmer Android untuk
Tabulet PC. Lokasi kerjanya di Jakarta dan full time.

Syaratnya, cukup sederhana, tertarik dengan Android (khususnya dalam urusan
oprek mengoprek) dan bisa programming Android (ga harus jago).

Untuk lebih jelasnya atau berminat, bisa langsung hubungi h...@tabuletpc.com

Terima kasih, hatur nuhun sadayana. :)

-- 
Ibnu Sina
just call me Ibun
twitter: @iboen

http://bit.ly/anw5Yz

-- 
===============
"

2. Using NetworkUtils to add a new route

Hi,

We implemented a system applciation that must add a route to one of
the existing network interfaces in the phone. We tried to use
NetworkUtils.addHostRoute() but we get "Operation Not Permited".
We see that MobileDataStateTracker uses it; from our understanding the
tracker is running within ConnectivityService which runs in the
SystemServer.
We also believe that SystemServer does not run as root.
We'd like to know what we have to do to make our system app able to
call addHostRoute().

Thanks and regards,

--

3. Paid app from UK.pls help

4. Android source

5. When will GoogleMap "3D" API be released?

6. hapus contact

7. Android Market buat ngeblank NJ