I have looked at lot of examples but so far I have only seen findViewById()
being used and the API also seems to have this technique only for accessing
different widgets.
- Sunit Katkar
http://sunitkatkar.blogspot.com/ - Android OS Tutorials



On Sat, Nov 22, 2008 at 12:38 PM, Doughy <[EMAIL PROTECTED]> wrote:

>
> OK, I see what you mean.  Thanks a ton for your help.
>
> I got my button callback working.  Now I have one more question.  Is
> it necessary to create the button and label objects in the main code,
> even though they are already declared in the UI XML file?  For
> example, the only way I could figure out to change the TextView text
> was to do the following lines in the onClickListener for the button:
>
>    private OnClickListener gossamerButListener = new OnClickListener
> ()
>    {
>        public void onClick(View v)
>        {
>             TextView answerLabel = (TextView)findViewById
> (R.id.answerLabel);
>            answerLabel.setText("Test");
>        }
>    };
>
> Is there a better way to do this?  Is there a way to directly access
> the TextView without using findViewbyId and casting it to the
> appropriate type?
>
> On Nov 22, 1:14 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> > Doughy wrote:
> > > I only have a total of 7 samples in that directory.  What version of
> > > the SDK are you running?
> >
> > There are 7 sample projects. However, the ApiDemos has hundreds of
> > sample activities. Virtually every source file in ApiDemos is its own
> > mostly-standalone activity.
> >
> > In the emulator, you can see all of them running via the API Demos
> > launcher icon.
> >
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> >
> > Android Training on the Ranch! -- Mar 16-20, 2009
> http://www.bignerdranch.com/schedule.shtml
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to