Thanks, this solved it
On Mar 17, 11:24 pm, Glen Humphrey <glendon.humphr...@gmail.com>
wrote:
> I believe your xml should look like this with "android:id" instead of
> just "id".
>
> <CheckBox android:id="@+id/checkbox"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> />
>
> On Mar 17, 10:25 am, zeeshan <genx...@gmail.com> wrote:
>
>
>
> > 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 <danra...@gmail.com> wrote:
>
> > > Try changing the id and see if it makes any difference.
>
> > > -Dan
>
> > > On Tue, Mar 17, 2009 at 9:46 AM, zeeshan <genx...@gmail.com> 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 -- 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---