Try:
TextView tv = (TextView)findViewById(R.id.myTxt);
--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together
The coverage you need at the price you want
The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.
On Sep 16, 5:34 am, ColletJb <[email protected]> wrote:
> Hi,
>
> I have already developed some widgets for android, but every time, I
> have the same problem... I Can' access my XML layout's elements from
> my java code.
>
> For example :
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout
> xmlns:android="http://schemas.android.com/apk/res/android"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent">
>
> <TextView
> android:id="@+id/myTxt"
> android:Text="HelloWorld !"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content" />
>
> </LinearLayout>
>
> With this layout, how can I access my "myTxt" object ?
>
> Thank you for your help
>
> ColletJb
>
> PS : In an Activity, the equivalent is "findViewById(int)".
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---