On 19.09.2010 12:55, Kieu Hua wrote:
> There is compile error in HelloAndroidTest program in the Tutorials
> “Hello Testing” program, because I got this compile error.
> “com.example.helloandroid.R.id.textview can not be resolved.”
> 
> @Override
>     protected void setUp() throws Exception {
>         super.setUp();
>         mActivity = this.getActivity();
>         mView = (TextView)
> mActivity.findViewById(com.example.helloandroid.R.id.textview);
>         resourceString =
> mActivity.getString(com.example.helloandroid.R.string.hello);
>     }
> 
> My com.example.helloandroid.R doesn’t have R.id.textview, and
> endroid.R.id class does not have endroid.R.id.textview field.
> 
> Where do I support to get this field, 
> “com.example.helloandroid.R.id.textview”?

You need to assign an ID to the TextView element which is to be
instantiated in mView. The ID should be set in the XML file defining the
UI and should look like this:

  android:id="@+id/textview"

You probably skipped the "Hello, World!" tutorial which sets up an XML
layout here:

http://developer.android.com/resources/tutorials/hello-world.html#upgrading


Cheers,

--Timo

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to