2012-09-15 68 views
0

我的活动正在轮换。 不知道为什么?旋转活动关闭

我也检查了这个问题: Activity restart on rotation 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(); 
} 
+0

是否强制关闭?说它没有回应? – Miguel

+0

No.Solved.Thanks to Rajendra。 –

回答

5

这可能会帮助你

if your android:targetSdkVersion="12" or less 
android:configChanges="orientation|keyboardHidden"> 

if your android:targetSdkVersion="13" or more 
android:configChanges="orientation|keyboardHidden|screenSize"> 
+0

你的问题解决了? – Rajendra

+0

解决。谢谢。 –

+0

享受....................... – Rajendra