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()方法的参数,当他读第一代码不是方法内正确参数时,他就出错

 

 

错误代码见附件图片

 

你可能感兴趣的:(resource)