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. Database on a G1

Anybody have any recommendations on building a SQLite database on a G1
phone?  On the emulator one can simply go to /data/data/.../databases
and build the database that your application needs.

Of course it doesn't have to be here but I can't find anywhere on the
G1 that I have write permission.

Is there a recommended place that one can and should build an
application's database on the G1?

Thanks for any insight.

Cheers, Scott
--~--~---------~--~----~------------~-------~--~----~

2. Mobihand

Some of the things that I've seen in Mobihands T&Cs;

1) Mobihand take 20% of all direct sales and 40% of sales through 
affiliate sites (i.e. those other than www.mobihand.com), this would 
appear to mean that sales through OnlyAndroid.com will see a Mobihand 
getting a 40% cut (see Payments section of the Service Description for 
the Content Distribution Service).

2) Mobihand are US based and so many non-US developers may suffer with 
Tax withholdings (see section 3b of mobihands "Software distribution 
agreement").

3) They also have a minimum charge of $3.95 (you can do free apps, or 
apps which cost $3.95 or more, but not apps for $1) (see Pricing section 
of the Service Description for the Content Distribution Service).

4) You have to offer them the lowest price possible, so if you have 
multiple distribution deals and one of your other distributors wants to 
take 20% off for a special promotion, you have to offer Mobihand that as 
well (see Pricing section of the Service Description for the Content 
Distribution Service).

5) If someone downloads a trial version from a Mobihand affiliate you 
can ONLY put a link to the affiliates site in your app for registrations 
(see Pricing section of the Service Description for the Content 
Distribution Service).

Al
---
http://andappstore.com/


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

3. platform updates on devices

4. Restoration of SMS reading capability.

5. Running Google's IM.apk, built from source

6. reverse geocoder timeout?

7. What is "ANDROID_PRODUCT_OUT" ?