Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Android tutorial now Working

Posted on 2010-01-05
7
Medium Priority
?
1,003 Views
Last Modified: 2013-11-13
Doing a android tutorial and followed step by step but when I put the following code in Im getting  "R.layout.main" and  "R.id.EditText01"  cannot be resolved.  Double checked my setup and I believe I have everything right.  Also in the example they provided it has R.id.button3 as R.id.Button3 but methods have Button with small b.

Im using the following website tutorial: http://www.vogella.de/articles/Android/article.html

package de.vogella.android.first;

import android.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class Hello extends Activity {
      private EditText text;
      
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        text = (EditText) findViewById(R.id.EditText01);
        text.setText("No button pressed");
    }
   
    //Will be connected with the buttons via XML
    public void myClickHandler(View view) {
          switch (view.getId()) {
          case R.id.button1:
                text.setText("Button 1 was clicked");
          case R.id.button2:
                text.setText("Button 2 was clicked");
          case R.id.button3:
                text.setText("Button 3 was clicked");
          }
    }
}
0
Comment
Question by:TheVeee
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 26181053
import android.R.*;

;JOOP!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 26181069
Or:

import android.R.id;

;JOOP!
0
 
LVL 5

Author Comment

by:TheVeee
ID: 26181245
Yeh those suggestions didnt work.....
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 24

Expert Comment

by:sciuriware
ID: 26181336
Sorry:

import android.R.layout.main;
import android.R.id.EditText01;

;JOOP!
0
 
LVL 5

Accepted Solution

by:
TheVeee earned 0 total points
ID: 26183588
Thanks for trying but what the issue is that you must first Run the android application even though it isnt complete.  This process will generate the R.java class (which your not suppose to touch).  Then once this is completed, the missing methods and variables are now available.

So long story short...

Go to project
Right click and select Run As Android application
After about a minute the R.java class will be generated and will having missing items now generated.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 26183626
So, there was no class file to reference;
you should tell that the next time.
;JOOP!
0
 
LVL 5

Author Comment

by:TheVeee
ID: 26183768
Well if I knew that, then it would have been fixed before I even posted this.  NO need to be snotty about it... you were way off track, but I had patience with your answers even though I knew they werent close.  
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses
Course of the Month21 days, 2 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question