[solved]R.id cannot be resolved

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

[solved]R.id cannot be resolved

Postby hallsofvallhalla » Thu Apr 30, 2009 4:37 pm

Yes another one of these...

Hello all I am a newbie with the android and java enviroment but I come from a pretty thick, php/javascript/mysql/ajax/ect..ect.. background.

Anyways I have been working with some tutorials and I keep getting stuck in one place. Looking through the forums I am not the only one. R.id cannot be resolved...ugh

I am wanting to create a button,

i started with a simple splash screen then wanted it to open up to some buttons, this code of course is not complete but doesnt matter because it still gives the same error


dice.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package dice.assist.com;
  2.  
  3.  
  4.  
  5. import android.app.Activity;
  6.  
  7. import android.content.Intent;
  8.  
  9. import android.os.Bundle;
  10.  
  11. import android.os.Handler;
  12.  
  13. import android.view.Menu;
  14.  
  15. import android.widget.Button;
  16.  
  17.  
  18.  
  19. public class dice extends Activity {
  20.  
  21.  
  22.  
  23.      // ===========================================================
  24.  
  25.      // Fields
  26.  
  27.      // ===========================================================
  28.  
  29.      
  30.  
  31.      private final int SPLASH_DISPLAY_LENGHT = 1000;
  32.  
  33.  
  34.  
  35.      // ===========================================================
  36.  
  37.      // "Constructors"
  38.  
  39.      // ===========================================================
  40.  
  41.  
  42.  
  43.      /** Called when the activity is first created. */
  44.  
  45.      @Override
  46.  
  47.      public void onCreate(Bundle icicle) {
  48.  
  49.           super.onCreate(icicle);
  50.  
  51.           setContentView(R.layout.main);
  52.  
  53.          
  54.  
  55.           /* New Handler to start the Menu-Activity
  56.  
  57.            * and close this Splash-Screen after some seconds.*/
  58.  
  59.           new Handler().postDelayed(new Runnable(){
  60.  
  61.                public void run() {
  62.  
  63.                     /* Create an Intent that will start the Menu-Activity. */
  64.  
  65.                     Intent mainIntent = new Intent(dice.this,Menu.class);
  66.  
  67.                     dice.this.startActivity(mainIntent);
  68.  
  69.                     dice.this.finish();
  70.  
  71.                }
  72.  
  73.           }, 5000);
  74.  
  75.      }
  76.  
  77. Button button=(Button) findViewById(R.id.d6button);
  78.  
  79.  
  80.  
  81.  
  82.  
  83. }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4



main.xml

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    android:orientation="vertical"
  6.  
  7.    android:layout_width="fill_parent"
  8.  
  9.    android:layout_height="fill_parent"
  10.  
  11.    >
  12.  
  13.     <ImageView
  14.  
  15.     android:layout_width="fill_parent"
  16.  
  17.     android:layout_height="fill_parent"
  18.  
  19.     android:scaleType="fitCenter"
  20.  
  21.     android:src="@drawable/splash"
  22.  
  23.     />
  24.  
  25.      <Button
  26.  
  27.     android:id="@+id/d6button"
  28.  
  29.     android:layout_width="fill_parent"
  30.  
  31.     android:layout_height="wrap_content"
  32.  
  33.     android:text:="1D6"
  34.  
  35.     />
  36.  
  37. </LinearLayout>
  38.  
  39.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


and my r.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. /* AUTO-GENERATED FILE.  DO NOT MODIFY.
  3.  
  4.  *
  5.  
  6.  * This class was automatically generated by the
  7.  
  8.  * aapt tool from the resource data it found.  It
  9.  
  10.  * should not be modified by hand.
  11.  
  12.  */
  13.  
  14.  
  15.  
  16. package dice.assist.com;
  17.  
  18.  
  19.  
  20. public final class R {
  21.  
  22.     public static final class attr {
  23.  
  24.     }
  25.  
  26.     public static final class drawable {
  27.  
  28.         public static final int icon=0x7f020000;
  29.  
  30.         public static final int splash=0x7f020001;
  31.  
  32.     }
  33.  
  34.     public static final class layout {
  35.  
  36.         public static final int main=0x7f030000;
  37.  
  38.     }
  39.  
  40.     public static final class string {
  41.  
  42.         public static final int app_name=0x7f040001;
  43.  
  44.         public static final int hello=0x7f040000;
  45.  
  46.     }
  47.  
  48. }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


i was noticing it is not creating a id class. even if i hit ctrl.shift.o.

so I think I see why I am getting the error but how do i fix?

Thanks for any help!
Last edited by hallsofvallhalla on Thu Apr 30, 2009 7:15 pm, edited 1 time in total.
hallsofvallhalla
Freshman
Freshman
 
Posts: 2
Joined: Thu Apr 30, 2009 4:25 pm
Location: mobile,al

Top

Postby hallsofvallhalla » Thu Apr 30, 2009 7:14 pm

well i feel like an idiot, i kept running through the code over and over and finally seen the problem...an extra : after the android:text!!!!
hallsofvallhalla
Freshman
Freshman
 
Posts: 2
Joined: Thu Apr 30, 2009 4:25 pm
Location: mobile,al

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 13 guests