And check your R.java file after you have created the @+id/button_id
in your layout file.
You will find button_id member in the sub class id of R.java.
Otherwise it is wrong in writing the layout file, because the Android
can not generate this for you.
On May 14, 8:54 pm, amateur <[EMAIL PROTECTED]> 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 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
-~----------~----~----~----~------~----~------~--~---