Sat*_*CyB 0 android rotation android-activity
我的活动正在接近轮换.不知道为什么?
此外,我检查了这个问题: 在Android上旋转活动重启 但无法找到解决方案.
这是我的oncreate函数:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.manage);
//Defining and Getting Saved Preferences
data=getSharedPreferences("cybapps", 0);
dataeditor=data.edit();
//To Delete all Preferences
dataeditor.clear();
dataeditor.commit();
//Declaration
btn_delete=(Button)findViewById(R.id.btn_delete);
btn_schedule=(Button)findViewById(R.id.btn_schedule);
btn_deschedule=(Button)findViewById(R.id.btn_deschedule);
profilelist=(ListView)findViewById(R.id.profilelist);
am=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
status=(TextView)findViewById(R.id.status);
random=new Random();
btn_delete.setOnClickListener(this);
btn_schedule.setOnClickListener(this);
btn_deschedule.setOnClickListener(this);
//Listout all profiles
listout();
}
Run Code Online (Sandbox Code Playgroud)
这可能对你有所帮助
if your android:targetSdkVersion="12" or less
android:configChanges="orientation|keyboardHidden">
if your android:targetSdkVersion="13" or more
android:configChanges="orientation|keyboardHidden|screenSize">
Run Code Online (Sandbox Code Playgroud)