Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

今天在写一个小例子时,处了一个错误让我找了一下午,下面是错误代码

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Log.i(tag, "-----");
        
        SharedPreferences share = super.getSharedPreferences(file, SharedActivity.MODE_PRIVATE);
       /* SharedPreferences.Editor editor = share.edit();
        
        editor.putString("author", "niufc");
        editor.putInt("age", 28);
        editor.commit();*/
        Log.i(tag, "ddddd");
       this.authorTextView =(TextView)super.findViewById(R.id.authortext);
       Log.i(tag, "uuuuu");
        this.ageTextView = (TextView)super.findViewById(R.id.agetext);
        
        
       this.authorTextView.setText("作者:"+share.getString("author", "没有纸")); 
       Log.i(tag, "mmmm");
       this.ageTextView.setText(share.getInt("age", 0));//错误点
    }

 红字的为错误代码,正确代码为

 

this.ageTextView.setText(""+share.getInt("age", 0));//错误点

 原来setText()方法的参数,当他读第一代码不是方法内正确参数时,他就出错

 

 

错误代码见附件图片

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值