Hi ,
   findViewById() method is used to get the object of the view.
*example*:
*main.xml* contain one button i want to provide the action for this button,
so we need to create the object in the java file by passing id.
<Button
        android:id="@+id/btn_New"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       android:text="new"
       />

*MainActivity .java*
public class MainActivity extends Activity {

       protected void onCreate(Bundle icicle) {
           super.onCreate(icicle);
//creation of button object
*Button buttonclickme=(Button)findViewById(r.id.btn_New);*


once we crate the object of the button we can provide action

buttonclickme.setOnClickListener(new View.OnClickListener()
        {

             public void onClick(View v)
             {

//here we have to write the code to execute when button clicked.

}}


Regards&Regards,
Naresh.


On Tue, Mar 5, 2013 at 6:06 PM, ramesh babu <[email protected]> wrote:

> for what purpose findViewById is used
>
> --
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to