fm/fmapp2/src/com/caf/fmradio/FMTransmitterActivity.java
@Override
   public void onCreate(Bundle savedInstanceState) {

      super.onCreate(savedInstanceState);
      mPrefs = new FmSharedPreferences(this);
      Log.d(LOGTAG, "onCreate - Height : "
             + getWindowManager().getDefaultDisplay().getHeight()
             + " - Width  : "
             + getWindowManager().getDefaultDisplay().getWidth());

      mDisplayWidth = getWindowManager().getDefaultDisplay().getWidth();
      DisplayMetrics outMetrics = new DisplayMetrics();
      getWindowManager().getDefaultDisplay().getMetrics(outMetrics);

      setContentView(R.layout.fmtransmitter);
      SavedDataAndState = (LoadedDataAndState)getLastNonConfigurationInstance();
      mAnimation = AnimationUtils.loadAnimation(this, R.anim.preset_select);

      mPicker = (HorizontalNumberPicker)findViewById(R.id.fm_picker);
      if(mPicker != null) {
         mPicker.setTextSize(mDisplayWidth / TEXTSIZE_PARAMETER_FOR_NUMBER_PICKER);
         mPicker.setDensity(outMetrics.densityDpi);
         mPicker.setOnValueChangedListener(new OnValueChangeListener() {
         @Override
           public void onValueChange(HorizontalNumberPicker picker,
             int oldVal, int newVal) {
             // TODO Auto-generated method stub
             valueToFrequency(newVal);
             mHandler.post(mRadioChangeFrequency);
           }
         });
       }
       mOnOffButton = (ImageView)findViewById(R.id.btn_onoff);
       if(mOnOffButton != null) {
          mOnOffButton.setOnClickListener(mTurnOnOffClickListener);
       }
       mForwardButton = (ImageView)findViewById(R.id.btn_forward);
       if(mForwardButton != null) {
          mForwardButton.setOnClickListener(mForwardClickListener);
       }
       mBackButton = (ImageView)findViewById(R.id.btn_back);
       if(mBackButton != null) {
          mBackButton.setOnClickListener(mBackClickListener);
       }

       /* Preset Buttons */
       mPresetButtons[0] = (Button)findViewById(R.id.presets_button_1);
       mPresetButtons[1] = (Button)findViewById(R.id.presets_button_2);
       mPresetButtons[2] = (Button)findViewById(R.id.presets_button_3);
       mPresetButtons[3] = (Button)findViewById(R.id.presets_button_4);
       mPresetButtons[4] = (Button)findViewById(R.id.presets_button_5);
       mPresetButtons[5] = (Button)findViewById(R.id.presets_button_6);
       mPresetButtons[6] = (Button)findViewById(R.id.presets_button_7);
       for(int nButton = 0; nButton < MAX_PRESETS; nButton++) {
          if (mPresetButtons[nButton] != null) {
              mPresetButtons[nButton].setOnClickListener(
                                        mPresetButtonClickListener);
              mPresetButtons[nButton].setOnLongClickListener(
                                            mPresetButtonOnLongClickListener);
          }
       }

       mTransmitStaticMsgTV = (TextView)findViewById(R.id.transmit_msg_tv);
       String str = getString(R.string.transmit_msg_string);
       if(null != mPSData) {
          str = mPSData.concat("\n").concat(str);
       }
       if(mTransmitStaticMsgTV != null) {
          mTransmitStaticMsgTV.setText(str);
       }

       mTuneStationFrequencyTV = (TextView)findViewById(R.id.prog_frequency_tv);
       if(mTuneStationFrequencyTV != null) {
          mTuneStationFrequencyTV.setOnLongClickListener(
                                       mFrequencyViewClickListener);
       }
       mRadioTextTV = (TextView)findViewById(R.id.radio_text_tv);

       if((mRadioTextScroller == null) && (mRadioTextTV != null)) {
          mRadioTextScroller = new ScrollerText(mRadioTextTV);
       }

       enableRadioOnOffUI(false);
       //HDMI and FM concurrecny is not supported.
       if(isHdmiOn()) {
          showDialog(DIALOG_CMD_FAILED_HDMI_ON);
       }else {
          if(false == bindToService(this, osc)) {
             Log.d(LOGTAG, "onCreate: Failed to Start Service");
          }else {
             Log.d(LOGTAG, "onCreate: Start Service completed successfully");
          }
          registerFMSettingListner();
       }
   }
/** Called when the activity is first created. */
Called when the activity is first created.
Called when the activity is first created .
@Override
   public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      mPrefs = new FmSharedPreferences(this);
      Log.d(LOGTAG, "onCreate - Height : "
             + getWindowManager().getDefaultDisplay().getHeight()
             + " - Width  : "
             + getWindowManager().getDefaultDisplay().getWidth());
      mDisplayWidth = getWindowManager().getDefaultDisplay().getWidth();
      DisplayMetrics outMetrics = new DisplayMetrics();
      getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
      setContentView(R.layout.fmtransmitter);
      SavedDataAndState = (LoadedDataAndState)getLastNonConfigurationInstance();
      mAnimation = AnimationUtils.loadAnimation(this, R.anim.preset_select);
      mPicker = (HorizontalNumberPicker)findViewById(R.id.fm_picker);
      if(mPicker != null) {
         mPicker.setTextSize(mDisplayWidth / TEXTSIZE_PARAMETER_FOR_NUMBER_PICKER);
         mPicker.setDensity(outMetrics.densityDpi);
         mPicker.setOnValueChangedListener(new OnValueChangeListener() {
         @Override
           public void onValueChange(HorizontalNumberPicker picker,
             int oldVal, int newVal) {
             valueToFrequency(newVal);
             mHandler.post(mRadioChangeFrequency);
           }
         });
       }
       mOnOffButton = (ImageView)findViewById(R.id.btn_onoff);
       if(mOnOffButton != null) {
          mOnOffButton.setOnClickListener(mTurnOnOffClickListener);
       }
       mForwardButton = (ImageView)findViewById(R.id.btn_forward);
       if(mForwardButton != null) {
          mForwardButton.setOnClickListener(mForwardClickListener);
       }
       mBackButton = (ImageView)findViewById(R.id.btn_back);
       if(mBackButton != null) {
          mBackButton.setOnClickListener(mBackClickListener);
       }
       /* Preset Buttons */
       mPresetButtons[0] = (Button)findViewById(R.id.presets_button_1);
       mPresetButtons[1] = (Button)findViewById(R.id.presets_button_2);
       mPresetButtons[2] = (Button)findViewById(R.id.presets_button_3);
       mPresetButtons[3] = (Button)findViewById(R.id.presets_button_4);
       mPresetButtons[4] = (Button)findViewById(R.id.presets_button_5);
       mPresetButtons[5] = (Button)findViewById(R.id.presets_button_6);
       mPresetButtons[6] = (Button)findViewById(R.id.presets_button_7);
       for(int nButton = 0; nButton < MAX_PRESETS; nButton++) {
          if (mPresetButtons[nButton] != null) {
              mPresetButtons[nButton].setOnClickListener(
                                        mPresetButtonClickListener);
              mPresetButtons[nButton].setOnLongClickListener(
                                            mPresetButtonOnLongClickListener);
          }
       }
       mTransmitStaticMsgTV = (TextView)findViewById(R.id.transmit_msg_tv);
       String str = getString(R.string.transmit_msg_string);
       if(null != mPSData) {
          str = mPSData.concat("\n").concat(str);
       }
       if(mTransmitStaticMsgTV != null) {
          mTransmitStaticMsgTV.setText(str);
       }
       mTuneStationFrequencyTV = (TextView)findViewById(R.id.prog_frequency_tv);
       if(mTuneStationFrequencyTV != null) {
          mTuneStationFrequencyTV.setOnLongClickListener(
                                       mFrequencyViewClickListener);
       }
       mRadioTextTV = (TextView)findViewById(R.id.radio_text_tv);
       if((mRadioTextScroller == null) && (mRadioTextTV != null)) {
          mRadioTextScroller = new ScrollerText(mRadioTextTV);
       }
       enableRadioOnOffUI(false);
       if(isHdmiOn()) {
          showDialog(DIALOG_CMD_FAILED_HDMI_ON);
       }else {
          if(false == bindToService(this, osc)) {
             Log.d(LOGTAG, "onCreate: Failed to Start Service");
          }else {
             Log.d(LOGTAG, "onCreate: Start Service completed successfully");
          }
          registerFMSettingListner();
       }
   }
@ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; mPrefs = new FmSharedPreferences ( this ) ; Log . d ( LOGTAG , "onCreate - Height : " + getWindowManager ( ) . getDefaultDisplay ( ) . getHeight ( ) + " - Width  : " + getWindowManager ( ) . getDefaultDisplay ( ) . getWidth ( ) ) ; mDisplayWidth = getWindowManager ( ) . getDefaultDisplay ( ) . getWidth ( ) ; DisplayMetrics outMetrics = new DisplayMetrics ( ) ; getWindowManager ( ) . getDefaultDisplay ( ) . getMetrics ( outMetrics ) ; setContentView ( R . layout . fmtransmitter ) ; SavedDataAndState = ( LoadedDataAndState ) getLastNonConfigurationInstance ( ) ; mAnimation = AnimationUtils . loadAnimation ( this , R . anim . preset_select ) ; mPicker = ( HorizontalNumberPicker ) findViewById ( R . id . fm_picker ) ; if ( mPicker != null ) { mPicker . setTextSize ( mDisplayWidth / TEXTSIZE_PARAMETER_FOR_NUMBER_PICKER ) ; mPicker . setDensity ( outMetrics . densityDpi ) ; mPicker . setOnValueChangedListener ( new OnValueChangeListener ( ) { @ Override public void onValueChange ( HorizontalNumberPicker picker , int oldVal , int newVal ) { valueToFrequency ( newVal ) ; mHandler . post ( mRadioChangeFrequency ) ; } } ) ; } mOnOffButton = ( ImageView ) findViewById ( R . id . btn_onoff ) ; if ( mOnOffButton != null ) { mOnOffButton . setOnClickListener ( mTurnOnOffClickListener ) ; } mForwardButton = ( ImageView ) findViewById ( R . id . btn_forward ) ; if ( mForwardButton != null ) { mForwardButton . setOnClickListener ( mForwardClickListener ) ; } mBackButton = ( ImageView ) findViewById ( R . id . btn_back ) ; if ( mBackButton != null ) { mBackButton . setOnClickListener ( mBackClickListener ) ; } /* Preset Buttons */ mPresetButtons [ 0 ] = ( Button ) findViewById ( R . id . presets_button_1 ) ; mPresetButtons [ 1 ] = ( Button ) findViewById ( R . id . presets_button_2 ) ; mPresetButtons [ 2 ] = ( Button ) findViewById ( R . id . presets_button_3 ) ; mPresetButtons [ 3 ] = ( Button ) findViewById ( R . id . presets_button_4 ) ; mPresetButtons [ 4 ] = ( Button ) findViewById ( R . id . presets_button_5 ) ; mPresetButtons [ 5 ] = ( Button ) findViewById ( R . id . presets_button_6 ) ; mPresetButtons [ 6 ] = ( Button ) findViewById ( R . id . presets_button_7 ) ; for ( int nButton = 0 ; nButton < MAX_PRESETS ; nButton ++ ) { if ( mPresetButtons [ nButton ] != null ) { mPresetButtons [ nButton ] . setOnClickListener ( mPresetButtonClickListener ) ; mPresetButtons [ nButton ] . setOnLongClickListener ( mPresetButtonOnLongClickListener ) ; } } mTransmitStaticMsgTV = ( TextView ) findViewById ( R . id . transmit_msg_tv ) ; String str = getString ( R . string . transmit_msg_string ) ; if ( null != mPSData ) { str = mPSData . concat ( "\n" ) . concat ( str ) ; } if ( mTransmitStaticMsgTV != null ) { mTransmitStaticMsgTV . setText ( str ) ; } mTuneStationFrequencyTV = ( TextView ) findViewById ( R . id . prog_frequency_tv ) ; if ( mTuneStationFrequencyTV != null ) { mTuneStationFrequencyTV . setOnLongClickListener ( mFrequencyViewClickListener ) ; } mRadioTextTV = ( TextView ) findViewById ( R . id . radio_text_tv ) ; if ( ( mRadioTextScroller == null ) && ( mRadioTextTV != null ) ) { mRadioTextScroller = new ScrollerText ( mRadioTextTV ) ; } enableRadioOnOffUI ( false ) ; if ( isHdmiOn ( ) ) { showDialog ( DIALOG_CMD_FAILED_HDMI_ON ) ; } else { if ( false == bindToService ( this , osc ) ) { Log . d ( LOGTAG , "onCreate: Failed to Start Service" ) ; } else { Log . d ( LOGTAG , "onCreate: Start Service completed successfully" ) ; } registerFMSettingListner ( ) ; } }
Called when the activity is first created.
Called when the activity is first created .
// TODO Auto-generated method stub //HDMI and FM concurrecny is not supported.