我是android开发的新手,所以请多多包涵。我在创建新活动时遇到了问题。在新创建的活动中,有自动生成的覆盖方法“onCreate”:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_find_contact);
// Show the Up button in the action bar.
setupActionBar();
}
在线上setContentView(R.layout.activity_find_contact);,我得到错误:activity_find_contact cannot be resolved or is not a field。
我已经查找了有关此主题的其他问题。有人说只是重新启动 Eclipse - 这不起作用。其他人说尝试清理项目 - 这也不起作用。最有希望的答案是删除该行:
import android.R;
我试过这个,当然然后R得到错误:R cannot be resolved to a variable. 所以我按照建议导入your.application.package.R;- 在我的上下文中转换为import com.example.databasetest.R;. 然而,这只是带来了错误the import com.example.databasetest.R; cannot be resolved to a type。
所以现在我被难住了,回到第一方。有任何想法吗?