amateur wrote:
> Hi all,
> 
> i copied the following code from google's website :
> 
> package a.b;
> 
> import android.app.Activity;
> import android.os.Bundle;
> import android.widget.Button;
> import android.widget.TextView;
> import android.view.View;
> 
> public class Myactivity extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle icicle) {
>         super.onCreate(icicle);
>         setContentView(R.layout.main);
> 
>         final Button button = (Button) findViewById(R.id.button_id);
>         button.setOnClickListener(new Button.OnClickListener() {
>             public void onClick(View v) {
>                 // Perform action on click
>             }
>         });
>     }
> }
> 
> this is for usage of buttons . but its showing error on the line
> having - (R.id.button_id);
> 
> when i check my R.java file i find there is no 'id' file generated
> hence the compiler has no idea of what R.id is .
> 
> can any body please help me ?

You also need to create a layout file that declares a widget as having 
an android:id of @+id/button_id.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
The Busy Coder's Guide to Android Development -- coming in June 2008!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to