You access XML Views by their ids, so if your TextView has the "tv1"
id attribute, you can use the standard way to access and modify it:

TextView tv = (TextView) findViewById(R.id.tv1);

and than..

tv.setText("New text");

On Apr 14, 3:58 pm, Bernardo <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I was trying to build an app for Android and got through the official
> tutorials... most of them use UI's created by a XML file...
>
> My question is: how do I access a view that has been created through a
> XML file at runtime?
>
> example: I create a TextView with "Original text" as it's text...
> then, at runtime, I want to change that to "New Text" (in the
> programatic way,I'd use the setText() function, but I have no idea how
> to access it).
>
> I've searched around but didn't find or couldn't understand the
> discussions :(
>
> Thanks in advance!
> Bernardo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to