android的菜单错误:add cannot be resolved or is not a field
来源:互联网 发布:淘宝客优惠券推广 编辑:程序博客网 时间:2024/06/05 20:56
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
//return super.onOptionsItemSelected(item);
//通过调用item.getItemID这个函数来进行选择菜单操作
switch(item.getItemId()){
case R.id.add item:
Toast.makeText(FirstViewActivity.this, "I love you ,Xinyu.", 300).show();
break;
case R.id.remove_item:
Toast.makeText(FirstViewActivity.this, "Do you know?",300).show();break;
}
return true;
// TODO Auto-generated method stub
//return super.onOptionsItemSelected(item);
//通过调用item.getItemID这个函数来进行选择菜单操作
switch(item.getItemId()){
case R.id.add item:
Toast.makeText(FirstViewActivity.this, "I love you ,Xinyu.", 300).show();
break;
case R.id.remove_item:
Toast.makeText(FirstViewActivity.this, "Do you know?",300).show();break;
}
return true;
}
这个的错误原因,我的是由于add item的个是错误了。与main.xml里面的不一样【其实是add item中间的"_"这个符号没有打上】
以下是我的string:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/add_item"
android:title="Add"/>
<item
android:id="@+id/remove_item"
android:title="Remove"/>
</menu>
0 0
- android的菜单错误:add cannot be resolved or is not a field
- Android中cannot be resolved or is not a field错误的解决办法
- Android中cannot be resolved or is not a field错误的解决办法
- (Layout) cannot be resolved or is not a field 错误
- main cannot be resolved or is not a field错误
- cannot be resolved or is not a field错误解决
- cannot be resolved or is not a field的问题解决
- android项目中出现out cannot be resolved or is not a field错误
- Android错误之--activity_main cannot be resolved or is not a field
- 出现"cannot be resolved or is not a field"莫名错误的解决方法
- 关于"cannot be resolved or is not a field"错误的解决方法
- main cannot be resolved or is not a field
- main cannot be resolved or is not a field
- layout cannot be resolved or is not a field
- main cannot be resolved or is not a field
- main cannot be resolved or is not a field
- main cannot be resolved or is not a field
- main cannot be resolved or is not a field
- 记自己独立完成项目(取得进展)
- Android访问网络,使用HttpURLConnection还是HttpClient?
- 黑马程序员——面向对象——多态-抽象类-接口
- 5.13viewPager&&viewFlipper
- 有关fstream::read()读取错误问题
- android的菜单错误:add cannot be resolved or is not a field
- 数据结构 ——单链表操作的算法
- 黑马程序员————面向对象
- [LeetCode] Longest Valid Parentheses
- POJ3067 Japan【树状数组】【逆序数】
- Java基础——集合框架工具类(Collections类和Arrays类)
- [Java IO]整理
- 为什么不会编程
- Remove Duplicates from Sorted Array II