Java android获取错误(获取资源号0x0000000a的值时没有包标识符)

Java android获取错误(获取资源号0x0000000a的值时没有包标识符),java,android,Java,Android,我使用listView和自定义arrayadaptor(其中包含3个文本视图和一个整数值),同时使用setText设置文本并调用返回整数的方法。我正在链接自定义阵列适配器和word文件,谢谢 只有在调用使用setText方法返回整数值的方法时,我才会出错 public class Word { private static final int dollar = 10; private static final String buttonNAME = "ADD

我使用listView和自定义arrayadaptor(其中包含3个文本视图和一个整数值),同时使用
setText
设置文本并调用返回整数的方法。我正在链接自定义阵列适配器和word文件,谢谢

只有在调用使用
setText
方法返回整数值的方法时,我才会出错

  public class Word {

        private static final int dollar = 10;
        private static final String buttonNAME = "ADD TO CART";

        //@var price var used for price description
        private int m Price;
        //@var mItemName var used for displaying item
        private String mItemName;

        //@constructor used to assign dag to the var

        public Word(int mPrice, String mItemName)
        {
            this.mPrice = mPrice;
            this.mItemName = mItemName;

        }

        public int getmPrice()
        {
            return mPrice;
        }

        public String getmItemName(){
            return mItemName;
        }

       public int getdollar()throws Exception{
            return dollar ;
            }
        public String getButtonnName(){
            return buttonNAME ;
        }
        }
自定义适配器

    class WordAdapter extends ArrayAdapter<Word> {



        WordAdapter(Activity context, ArrayList<Word> items){

            super(context,0,items);
        }

        @NonNull
        @Override
        public View getView(int position, View convertView, @NonNull ViewGroup parent)  {
            // Check if the existing view is being reused, otherwise inflate the view
            View listItemView = convertView;
            if(listItemView == null) {
                listItemView = LayoutInflater.from(getContext()).inflate(
                        list_items, parent, false);
            }

            // Get the {@link AndroidFlavor} object located at this position in the list
            Word currentPosition= getItem(position);

            // Find the TextView in the list_item.xml layout with the ID version_name

            // Find the TextView in the list_item.xml layout with the ID version_number
            TextView itemTextView = (TextView) listItemView.findViewById(R.id.listitems_item);
            // Get the version number from the current AndroidFlavor object and
            // set this text on the number TextView


            if (currentPosition != null) {
                itemTextView.setText(currentPosition.getmItemName());
            }


            TextView dollarTextView = (TextView) listItemView.findViewById(R.id.listitems_dollor);
            // Get the version number from the current AndroidFlavor object and
            // set this text on the number TextView

            try {
                if (currentPosition != null)
                    dollarTextView.setText(currentPosition.getdollar());

            }
            catch (Exception e)
            {
                e.getStackTrace();
                Log.v("coffe","satya");
            }



            Button buttoName = (Button) listItemView.findViewById(R.id.listitems_addcart);

            if (currentPosition != null) {
                buttoName.setText(currentPosition.getButtonnName());
            }
            TextView priceTextView = (TextView) listItemView.findViewById(R.id.list_items_price);
            try {
                if (currentPosition != null)
                    priceTextView.setText(currentPosition.getmPrice());

            }
            catch (Exception e)
            {
                e.getStackTrace();
                Log.v("coffe","satya");
            }


            return listItemView;
        }

    }
class WordAdapter扩展了ArrayAdapter{
WordAdapter(活动上下文、ArrayList项){
超级(上下文,0,项);
}
@非空
@凌驾
公共视图getView(int位置,视图转换视图,@NonNull视图组父级){
//检查现有视图是否正在重新使用,否则会膨胀视图
View listItemView=convertView;
如果(listItemView==null){
listItemView=LayoutFlater.from(getContext()).inflate(
列出项目,父项,false);
}
//获取位于列表中此位置的{@link AndroidFlavor}对象
单词currentPosition=getItem(位置);
//在list_item.xml布局中查找ID版本名称为的TextView
//在list_item.xml布局中查找ID版本号为的TextView
TextView itemTextView=(TextView)listItemView.findViewById(R.id.listitems\u项);
//从当前AndroidFlavor对象获取版本号,然后
//在数字文本视图上设置此文本
如果(当前位置!=null){
itemTextView.setText(currentPosition.getmItemName());
}
TextView dollarTextView=(TextView)listItemView.findViewById(R.id.listitems\u doller);
//从当前AndroidFlavor对象获取版本号,然后
//在数字文本视图上设置此文本
试一试{
如果(当前位置!=null)
dollarTextView.setText(currentPosition.getdollar());
}
捕获(例外e)
{
e、 getStackTrace();
Log.v(“coffe”、“satya”);
}
Button ButtonName=(Button)listItemView.findViewById(R.id.listitems\u addcart);
如果(当前位置!=null){
ButtonName.setText(currentPosition.GetButtonName());
}
TextView价格TextView=(TextView)listItemView.findViewById(R.id.list\u items\u price);
试一试{
如果(当前位置!=null)
priceTextView.setText(currentPosition.getmPrice());
}
捕获(例外e)
{
e、 getStackTrace();
Log.v(“coffe”、“satya”);
}
返回listItemView;
}
}

要使用
setText
方法返回整数的值,需要使用
setText(xxx+)

示例

 priceTextView.setText(currentPosition.getmPrice()+"");

要使用
setText
方法返回整数的值,需要使用
setText(xxx+)

示例

 priceTextView.setText(currentPosition.getmPrice()+"");
使用以下命令:

Integer.toString(currentPosition.getmPrice());
或者这个:

String.valueOf(currentPosition.getmPrice());
使用以下命令:

Integer.toString(currentPosition.getmPrice());
或者这个:

String.valueOf(currentPosition.getmPrice());

我必须在注释中放置什么我的意思是在+put
之后足够。我必须在+put
之后放置什么我的意思是在+put
之后足够。