import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;SharedPreferences s = SharedPreferences.this.getSharedPreferences("sidney", Context.MODE_PRIVATE);这样写,不对吗??? 为什么一直报错,提示需要强转型我改为:SharedPreferences s = (SharedPreferences)SharedPreferences.this.getSharedPreferences("sidney", Context.MODE_PRIVATE);但是这样写后,s.edit();这个方法都没有了,太奇怪了。 我用的Android 2.3.3
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;SharedPreferences s = SharedPreferences.this.getSharedPreferences("sidney", Context.MODE_PRIVATE);这样写,不对吗??? 为什么一直报错,提示需要强转型我改为:SharedPreferences s = (SharedPreferences)SharedPreferences.this.getSharedPreferences("sidney", Context.MODE_PRIVATE);但是这样写后,s.edit();这个方法都没有了,太奇怪了。 我用的Android 2.3.3
解决方案 »
- 求助IOException (Permission denied)
- addPreferencesFromResource 过期问题
- 无法运行android应用
- 滑着舒心,做着费心! ListView之滑动纠结问题。
- 了解HAL层的朋友,帮忙看一下\system\lib\hw\*.so的问题
- 如何通过程序在View上放置一个EditText?
- Android NDK中如何编译Box2d c++获得so文件?
- 如何知道一个程序被打开或被关闭了??
- 蛋疼贴:Android的框架糟透了
- 大家对中兴扶持开发者联盟这事怎么看?
- TabWidget想垂直显示,怎么弄啊
- eclipse 如何导入新浪微博的java sdk
SharedPreferences.Editor editor = settings.edit(); 这样试试