content_layout_id error

Put your problem here if it does not fit any of the other categories.

content_layout_id error

Postby emmarbee » Sun Sep 12, 2010 5:46 am

Hi,
I need to create a button. I copied the code for Button from developer.android.com, but it didn't work. It is showing error in the line "R.layout.content_layout_id" and "R.id.button_id". See the screenshot too
Image
Screenshot URL http://picasaweb.google.com/lh/photo/O6ME9Pso1uwzkbglG8OmOg?feat=directlink
What should I do to rectify this error?

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.CalcPkg;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. import android.widget.Button;
  7. import android.widget.TextView;
  8. import android.Manifest;
  9. import android.widget.*;
  10.  
  11.  
  12. public class CalcActivity extends Activity {
  13.     protected void onCreate(Bundle icicle) {
  14.         super.onCreate(icicle);
  15.  
  16.         setContentView(R.layout.content_layout_id);
  17.  
  18.         final Button button = (Button) findViewById(R.id.button_id);
  19.         button.setOnClickListener(new View.OnClickListener() {
  20.             public void onClick(View v) {
  21.                 // Perform action on click
  22.             }
  23.         });
  24.     }
  25. }
  26.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
emmarbee
Freshman
Freshman
 
Posts: 5
Joined: Thu Sep 09, 2010 11:00 am

Top

Re: content_layout_id error

Postby jonbonazza » Mon Sep 13, 2010 3:54 pm

create a layout called content_layout_id and a button with the id "button_id"...
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 20 guests