Hello,
what for the creation of import x.y.z.R; ?
R.java will be automatically created under the specified package itself.


On Fri, May 9, 2008 at 11:49 PM, higgsboson <[EMAIL PROTECTED]> wrote:

>
>
> I have had a similar problem which I solved, so this might help.
> I was creating an app from scratch, and had the main package name in
> the form x.y.z and under that I had the Java class that was entry
> point, and at the same level the R.java was created for me.
> The problem was that when the application was created by the Eclipse
> plugin, it had put in
>
> import android.R;
>
> but now my R was not under android, it was under x.y.z
> therefore changing the import to
>
> import x.y.z.R;
>
> meant it would resolve happily.
>
>
>
> On Apr 22, 1:31 pm, Kastagire <[EMAIL PROTECTED]> wrote:
> > Hey all,
> > I have been fiddling around with Android for the past couple of days,
> > and I was working through the tutorials and sample code. Yesterday, I
> > made an interface with DroidDraw, which generates XML to make the GUI.
> > As far as I can see, everything is in order, but I have an error when
> > it goes to pull the XML from the layout folder. It says
> thatR.layout.maincannot be resolved, and thus all subsequent links to the
> > XML get a similar error. I have been plugging away on this problem for
> > a couple of hours, but cannot get it to work. I checked the forums
> > already, and someone mentioned that the version of DroidDraw may not
> > be compatible with the new SDK, but I checked what was posted, and it
> > seemed to work fine. Below is the JAVA code, and then the XML from
> > Droid Draw.. any help would be appreciated!!!
> >
> > Thanks!
> >
> > package com.android.androidtake2;
> >
> > import android.R;
> > import android.app.Activity;
> > import android.os.Bundle;
> > import android.view.View;
> > import android.view.View.OnClickListener;
> > import android.widget.Button;
> > import android.widget.RadioButton;
> > import android.widget.TextView;
> >
> > public class androidtake2 extends Activity implements OnClickListener
> > {
> >         TextView dollars;
> >         TextView euros;
> >     RadioButton dtoe;
> >     RadioButton etod;
> >         Button convert;
> >
> >         /** Called when the activity is first created. */
> >     @Override
> >     public void onCreate(Bundle icicle) {
> >         super.onCreate(icicle);
> >         setContentView(R.layout.main);
> >
> >         dollars = (TextView)this.findViewById(R.id.dollars);
> >         euros = (TextView)this.findViewById(R.id.euros);
> >
> >         dtoe = (RadioButton)this.findViewById(R.id.dtoe);
> >         dtoe.setChecked(true);
> >         etod = (RadioButton)this.findViewById(R.id.etod);
> >
> >         convert = (Button)this.findViewById(R.id.convert);
> >         convert.setOnClickListener(this);
> >     }
> >
> >         public void onClick(View v) {
> >                 if (dtoe.isChecked()) {
> >                         convertDollarsToEuros();
> >                 }
> >                 if (etod.isChecked()) {
> >                         convertEurosToDollars();
> >                 }
> >         }
> >
> >         protected void convertDollarsToEuros() {
> >                 double val =
> Double.parseDouble(dollars.getText().toString());
> >                                 euros.setText(Double.toString(val*0.67));
> >         }
> >
> >         protected void convertEurosToDollars() {
> >                 double val =
> Double.parseDouble(euros.getText().toString());
> >                         dollars.setText(Double.toString(val/0.67));
> >         }
> >
> > }
> >
> > "DroidDraw" XML-
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <AbsoluteLayout
> > android:id="@+id/widget63"
> > android:layout_width="fill_parent"
> > android:layout_height="fill_parent"
> > xmlns:android="http://schemas.android.com/apk/res/android";
> >
> > <LinearLayout
> > android:id="@+id/widget96"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > xmlns:android="http://schemas.android.com/apk/res/android";
> > android:orientation="vertical"
> > android:layout_x="91px"
> > android:layout_y="0px"
> >
> > <EditText
> > android:id="@+id/viewdol"
> > android:layout_width="100 px"
> > android:layout_height="wrap_content"
> > android:text="Dollars"
> > android:textSize="18sp"
> > android:textStyle="bold"
> >
> > </EditText>
> > <TextView
> > android:id="@+id/dollars"
> > android:layout_width="100 px"
> > android:layout_height="wrap_content"
> > android:background="@drawable/lightgray"
> >
> > </TextView>
> > <EditText
> > android:id="@+id/vieweuro"
> > android:layout_width="100 px"
> > android:layout_height="wrap_content"
> > android:text="Euros"
> > android:textSize="18sp"
> > android:textStyle="bold"
> >
> > </EditText>
> > <TextView
> > android:id="@+id/euros"
> > android:layout_width="100 px"
> > android:layout_height="wrap_content"
> > android:background="@drawable/lightgray"
> >
> > </TextView>
> > <RadioButton
> > android:id="@+id/dtoe"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="Dollars to Euros"
> >
> > </RadioButton>
> > <RadioButton
> > android:id="@+id/etod"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="Euros to Dollars"
> >
> > </RadioButton>
> > </LinearLayout>
> > <Button
> > android:id="@+id/convert"
> > android:layout_width="200px"
> > android:layout_height="wrap_content"
> > android:background="@drawable/green"
> > android:text="Convert"
> > android:layout_x="60px"
> > android:layout_y="229px"
> >
> > </Button>
> > </AbsoluteLayout>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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