i changed the id but still same Null object.
same result for TextView and ProgressBar as well, however i can use
EditText successfully.


On Mar 17, 5:04 pm, dan raaka <[email protected]> wrote:
> Try changing the id and see if it makes any difference.
>
> -Dan
>
>
>
> On Tue, Mar 17, 2009 at 9:46 AM, zeeshan <[email protected]> wrote:
>
> > Hi Android Experts,
>
> > why CheckBox is always null.
>
> > please find the error in my code:
>
> > xml-
>
> > <CheckBox id="@+id/checkbox"
> >  android:layout_width="wrap_content"
> >  android:layout_height="wrap_content"
> >                        />
>
> > code file-
>
> > package com.reblogr.reblogrclient;
>
> > public class Test extends Activity {
> >    /** Called when the activity is first created. */
>
> >           public CheckBox checkbox;
>
> >   @Override
> >    public void onCreate(Bundle savedInstanceState) {
>
> >        super.onCreate(savedInstanceState);
> >        setContentView(R.layout.login);
> >        Button connectButton = (Button)findViewById(R.id.objBtn1);
>
> >         checkbox= (CheckBox)findViewById(R.id.checkbox);
>
> >         connectButton.setOnClickListener(connectButtonListener);
> >        }
> >   public OnClickListener connectButtonListener = new OnClickListener
> > ()
> >   {
> >       public void onClick(View v)
> >       {
>
> >          Athenticate();
>
> >       }
> >   };
> >   public void Athenticate(){
>
> >                            if(checkbox.isChecked()){   //
> > NullPointerException here
> >                            //do something
>
> >                               }
>
> >   }
>
> > }
>
> > why checkbox is null?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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