我正在使用Eclipse Galileo完成Android“Hello, Testing”教程。当我尝试编译并运行程序时,出现了一个错误,提示“com.example.helloandroid.R.id无法解析”。请参考http://developer.android.com/resources/tutorials/testing/helloandroid_test.html。
感谢您能提供任何帮助和建议!
package com.example.helloandroid.test;
import com.example.helloandroid.HelloAndroid;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.TextView;
public class HelloAndroidTest extends ActivityInstrumentationTestCase2<HelloAndroid>
{
private HelloAndroid mActivity; // the activity under test
private TextView mView; // the activity's TextView (the only view)
private String resourceString;
public HelloAndroidTest()
{
super("com.example.helloandroid", HelloAndroid.class);
}
@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);
}
public void testPreconditions()
{
assertNotNull(mView);
}
public void testText()
{
assertEquals(resourceString,(String)mView.getText());
}
}
感谢您能提供任何帮助和建议!