0

My Activity is getting close on rotation. Don't know why?

Also i checked this question: Activity restart on rotation Android But can't able to find solution.

This is my oncreate function:

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();
}
Community
  • 1
  • 1

1 Answers1

5

This may help you

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

if your  android:targetSdkVersion="13" or more
android:configChanges="orientation|keyboardHidden|screenSize">
Rajendra
  • 1,700
  • 14
  • 17