Are you using the Android plugin for Eclipse. Try using it as it creates the
necessary files, packages and defaults for building an app. I always use the
plugin as it saves a lot of time.

On Wed, Oct 15, 2008 at 6:27 PM, alexdonnini <[EMAIL PROTECTED]> wrote:

>
> Hello,
>
> I have just started working with Android. In general, things have gone
> smoothly. I have been able to load, modify, compile and run
> applications without problems. The one exception is when I try to
> create a completely new project and then add existing code to the new
> application.
>
> For example, I created a new project called testdialog, a new
> application and activity called Test, and a new package called
> com.android.testdialog. So far, so good.
>
> After the application was created, I replaced the application code
> (except for the package line) and the layout file with the code listed
> below (which I found in a message posted in this group, I believe).
>
> I tired to have Android produce R.java by building the application. It
> did not work. no R.java was produced.
>
> As a consequence, the application reported many "R.xx cannot be
> resolved" errors.
> The layout file reported many "ERROR no resource identifier..."
> errors.
>
> I feel as if I am missing something very elementary and simple.
> Unfortunately I could not find any information about this in the
> Android documentation, or in the messages posted in this group.
>
> I would appreciate it if someone could help me out.
>
> Thanks.
>
> Alex
>
> "import android.R;
> import android.app.Activity;
> import android.app.AlertDialog;
> import android.app.Dialog;
> import android.content.DialogInterface;
> import android.content.DialogInterface.OnClickListener;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.Button;
> import android.widget.EditText;
>
> public class Test extends Activity {
>
>    private static final int DIALOG_ID = 1;
>
>    @Override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        setContentView(R.layout.main);
>
>        Button btn = (Button)findViewById(R.id.test);
>
>        btn.setOnClickListener(new android.view.View.OnClickListener()
> {
>          @Override
>          public void onClick(View v) {
>            showDialog(DIALOG_ID);
>          }});
>    }
>
>    @Override
>    protected Dialog onCreateDialog(int id) {
>      if(id == DIALOG_ID){
>        EditText mytext = (EditText)findViewById(R.id.mytext);
>        return new AlertDialog.Builder(Test.this)
>        .setTitle(mytext.getText().toString())
>        .setPositiveButton("OK", new OnClickListener(){
>          public void onClick(DialogInterface dialog, int which) {}})
>        .create();
>      }
>
>      return null;
>    }
>
> } "
>
> and the layout file with the following:
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>    android:orientation="vertical"
>    android:layout_width="fill_parent"
>    android:layout_height="fill_parent"
>    >
>
>   <EditText
>           android:id="@+id/mytext"
>       android:layout_width="fill_parent"
>       android:layout_height="wrap_content"
>       android:background="@android:drawable/editbox_background"/>
>  <Button
>        android:id="@+id/test"
>     android:layout_width="wrap_content"
>     android:layout_height="wrap_content"
>     android:text="TEST"/>
>
> </LinearLayout>
>
> >
>


-- 
- Sunit Katkar

--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to