mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Android: Use findViewById instead of getChildAt
More futureproof if anything else is added to the layout.
This commit is contained in:
@ -10,14 +10,14 @@
|
|||||||
<SeekBar
|
<SeekBar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/seekBar"
|
android:id="@+id/sliderSeekBar"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:text="Sample Text"
|
tools:text="Sample Text"
|
||||||
android:id="@+id/textView"
|
android:id="@+id/sliderTextView"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -40,8 +40,8 @@ public class SliderPreference extends DialogPreference implements SeekBar.OnSeek
|
|||||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||||
LinearLayout layout = (LinearLayout)inflater.inflate(R.layout.slider_layout, null, false);
|
LinearLayout layout = (LinearLayout)inflater.inflate(R.layout.slider_layout, null, false);
|
||||||
|
|
||||||
m_seekbar = (SeekBar)layout.getChildAt(0);
|
m_seekbar = (SeekBar)layout.findViewById(R.id.sliderSeekBar);
|
||||||
m_textview = (TextView)layout.getChildAt(1);
|
m_textview = (TextView)layout.findViewById(R.id.sliderTextView);
|
||||||
|
|
||||||
if (shouldPersist())
|
if (shouldPersist())
|
||||||
m_value = Integer.valueOf(getPersistedString(Integer.toString(m_value)));
|
m_value = Integer.valueOf(getPersistedString(Integer.toString(m_value)));
|
||||||
|
Reference in New Issue
Block a user