From 6176dfc23f5a092ca1b2ee3d07d7076821ec6095 Mon Sep 17 00:00:00 2001 From: Chung-yih Wang Date: Tue, 13 Sep 2011 16:00:20 +0800 Subject: Fix the NPE in IndicatorControlBarContainer. bug:5299759 move the view inits to onFinishInflate(). Change-Id: I3a3adb01805fbfb5e22d58f86c9d5da3ce3585a6 --- src/com/android/camera/ui/IndicatorControlBar.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/com/android/camera/ui/IndicatorControlBar.java') diff --git a/src/com/android/camera/ui/IndicatorControlBar.java b/src/com/android/camera/ui/IndicatorControlBar.java index ff986ee..3838508 100644 --- a/src/com/android/camera/ui/IndicatorControlBar.java +++ b/src/com/android/camera/ui/IndicatorControlBar.java @@ -39,6 +39,14 @@ public class IndicatorControlBar extends IndicatorControl implements super(context, attrs); } + @Override + protected void onFinishInflate() { + mZoomIcon = (ImageView) findViewById(R.id.zoom_control_icon); + mSecondLevelIcon = (ImageView) + findViewById(R.id.second_level_indicator_bar_icon); + mSecondLevelIcon.setOnClickListener(this); + } + public void initialize(Context context, PreferenceGroup group, String flashSetting, boolean zoomSupported) { // From UI spec, we have camera_flash setting on the first level. @@ -50,13 +58,10 @@ public class IndicatorControlBar extends IndicatorControl implements // add Zoom Icon. if (zoomSupported) { - mZoomIcon = (ImageView) findViewById(R.id.zoom_control_icon); mZoomIcon.setOnTouchListener(this); mZoomIcon.setVisibility(View.VISIBLE); } - mSecondLevelIcon = (ImageView) findViewById(R.id.second_level_indicator_bar_icon); - mSecondLevelIcon.setOnClickListener(this); requestLayout(); } -- cgit v1.1