emperorb2g
Lurker
Hi,
I am creating 4 buttons in the linear layout at the very bottom of the screen using the below code snippet
<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>
I initialised all 4 buttons inside the onClick() using the following snippet
private Button back, add, find, next;
back=(Button)findViewById(R.id.back);
back.setOnClickListener(this);
similarly other 3
I am handling the same using onClickListener
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");
}
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
I am creating 4 buttons in the linear layout at the very bottom of the screen using the below code snippet
<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>
I initialised all 4 buttons inside the onClick() using the following snippet
private Button back, add, find, next;
back=(Button)findViewById(R.id.back);
back.setOnClickListener(this);
similarly other 3
I am handling the same using onClickListener
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");
}
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