onconfigurationchanged

Null object reference if configuration changes

眉间皱痕 提交于 2019-12-06 02:58:23
I get null object reference if configuration changes for only LinearLayout objects. landscape mode I have to setVisiblity = View.GONE for all views except one view portrait mode I have to setVisibility = View.VISIBLE for all views: if (Activity started in portrait mode then turned into landscape) {it work fine} else {it get null object reference only for linearLayout objects} objects return this error are called chart , progress_layout . edited most of class "related code snippet" cause full class 1000 line cannot post it public class Cardio extends ActionBarActivity implements InsertDialogue

In android background image does not change when orientation does

天涯浪子 提交于 2019-12-05 19:08:20
I have a linear layout for my ActivityGroup as defined <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:mtx="http://schemas.android.com/apk/res/com.matriksdata" android:id="@+id/homeActivityGroupBG" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/background"> And i have 2 background drawables located in "drawable" and "drawable-land" folders. When orientation changes everything is normal but background is not changed according to orientation. It always keeps the very first drawable

Android onConfigurationChanged: how to save and restore fragment back stack?

折月煮酒 提交于 2019-12-05 03:22:13
I have an activity with a dual pane: a list of menu items on the left (fragment M) and details of the currently selected item on the right (fragment D). When the user selects an item in fragment D, fragment D gets replaced with another fragment (let's call it D1). When the user selects an item in fragment D1, fragment D1 gets replaced with another fragment (let's call it D2), and so on. Of course, when the user presses the back button she can go back in the fragments history: D2->D1->D. My problem is: how can I save and restore the full fragment back stack upon configuration change (in

How to get NEW width/height of root layout in onConfigurationChanged?

余生颓废 提交于 2019-12-03 05:47:05
问题 One of our views has a ScrollView as its root layout. When the device is rotated and onConfigurationChanged() is called, we'd like to be able to get the ScrollView 's new width/height. Our code looks like this: @Override public void onConfigurationChanged(Configuration newConfig) { Log.d(TAG, "Width: '" + findViewById(R.id.scrollview).getWidth() + "'"); Log.d(TAG, "Height: '" + findViewById(R.id.scrollview).getHeight() + "'"); super.onConfigurationChanged(newConfig); Log.d(TAG, "Width: '" +

How to get NEW width/height of root layout in onConfigurationChanged?

只谈情不闲聊 提交于 2019-12-02 19:08:58
One of our views has a ScrollView as its root layout. When the device is rotated and onConfigurationChanged() is called, we'd like to be able to get the ScrollView 's new width/height. Our code looks like this: @Override public void onConfigurationChanged(Configuration newConfig) { Log.d(TAG, "Width: '" + findViewById(R.id.scrollview).getWidth() + "'"); Log.d(TAG, "Height: '" + findViewById(R.id.scrollview).getHeight() + "'"); super.onConfigurationChanged(newConfig); Log.d(TAG, "Width: '" + findViewById(R.id.scrollview).getWidth() + "'"); Log.d(TAG, "Height: '" + findViewById(R.id.scrollview)

Android landscape right to landscape left event

筅森魡賤 提交于 2019-12-02 15:23:34
问题 I would like to now if the is any possible way to trigger an event when the layout is being redrawn because of the event of switching directly from landscape right orientation to landscape left orientation. I tried the OrientationEventListener. The problem is that it triggers to fast. I am doing UI changes and they happen before the landscape is being redrawn, and it looks bad. I could just add some delay on the changes but depending on the phone that change could last more or less. For the

Android landscape right to landscape left event

岁酱吖の 提交于 2019-12-02 08:08:56
I would like to now if the is any possible way to trigger an event when the layout is being redrawn because of the event of switching directly from landscape right orientation to landscape left orientation. I tried the OrientationEventListener. The problem is that it triggers to fast. I am doing UI changes and they happen before the landscape is being redrawn, and it looks bad. I could just add some delay on the changes but depending on the phone that change could last more or less. For the onConfigurationChanged the timing is perfect, but of course it only works for portrait to landscape or

Using onConfigurationChanged in a fragment

蓝咒 提交于 2019-11-30 11:47:08
I have this code in a fragment public class TestOne extends Fragment { View view = null; @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); LayoutInflater inflater2 = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater2.inflate(R.layout.testone, null); Toast.makeText(getActivity(), "Rotate fragment", Toast.LENGTH_SHORT).show(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Toast.makeText(getActivity(), "onCreate Fragment", Toast.LENGTH

android : How to prevent resizing the window when displaying the virtual keyboard

时光总嘲笑我的痴心妄想 提交于 2019-11-30 08:05:24
I am using a tabbed application. There is an EditText my application. When I click on the EditText, the window is getting resized and the virtual keyboard is displaying at the bottom of the window. But the four tabs are displaying at the top of the keyboard. I do not want to display my tabs, when the keyborad is displaying. Or I do not want to resize my window. My need is just to hide the tabs and other things below the EditText. I use all options with 'android:windowSoftInputMode' in my manifest. bUT I can not see any differences. Please give me the solution. Thank you.. When Virtual keyboard

Using onConfigurationChanged in a fragment

无人久伴 提交于 2019-11-29 17:50:41
问题 I have this code in a fragment public class TestOne extends Fragment { View view = null; @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); LayoutInflater inflater2 = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater2.inflate(R.layout.testone, null); Toast.makeText(getActivity(), "Rotate fragment", Toast.LENGTH_SHORT).show(); } @Override public void onCreate(Bundle savedInstanceState)