Your original post said that the buttons were instantiated inside
onClick() not onCreate(). Just wanted to clarify that.

Can you post your exception stack trace here?

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

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 Jul 30, 8:58 pm, "Bharath B.G." <[email protected]> wrote:
> Ya i hav called setContentView()
>
> wat is the problem if i create adn instantiate the buttons inside the
> onCreate()...?
>
>
>
> On Fri, Jul 31, 2009 at 2:17 AM, Jack Ha <[email protected]> wrote:
> > Did you call setContentView() in onCreate()? BTW, why did you
> > instantiate the buttons inside onClick()?
>
> > --
> > Jack Ha
> > Open Source Development Center
> > ・T・ ・ ・Mobile・ stick together
>
> > 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 Jul 29, 9:10 pm, bharath_mlore <[email protected]> wrote:
> > > [b]Hi,
>
> > > I am creating 4 buttons in the linear layout at the very bottom of the
> > > screen using the below code snippet
> > > [/b]
> > > <LinearLayout
> > >             android:clickable="true"
> > >                 android:layout_width="fill_parent"
> > >                 android:layout_height="wrap_content"
> > >                 android:background="#FFFFFF"    >
>
> > >                 <Button
> > >                         android:id="@+id/back"
> > >                         android:layout_height="wrap_content"
> > >                         android:layout_width="wrap_content"
> > >                         android:textColor="@color/darktext"
> > >                         android:text="Back"
> > >                         android:background="@drawable/blb_upr_r_btn"
> > >                         android:layout_marginRight="1px"
> > >                         android:layout_marginLeft="1px"
> > android:clickable="true"
> > > android:ellipsize="none"   />
>
> > >                 similarly other  3 buttons such as Add, Find and Next
>
> > > </LinearLayout>
>
> > > [b]I initialised all 4 buttons inside the onClick() using the
> > > following snippet[/b]
>
> > >        private Button back, add, find, next;
>
> > >         back=(Button)findViewById(R.id.back);
> > >         back.setOnClickListener(this);
>
> > >         similarly other 3
>
> > > [b]I am handling the same using onClickListener[/b]
>
> > >            if(id==back.getId())
> > >            {
> > >                 //code
> > >            }
> > >            else if(id==add.getId())
> > >            {
> > >                  //code
> > >            }
> > >            else if(id==find.getId())
> > >            {
> > >                   //code
> > >            }
> > >            else if(id==next.getId())
> > >            {
> > >                  next.setText("Clicked");
> > >            }
>
> > > [b]But When i run the application and click on any of these 4 buttons
> > > the application closes telling some unhandled exception has occured,
> > > please help me to sort out this[/b]
>
> --
> Bharath B.G.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to