Example usage for android.widget TextView getText

List of usage examples for android.widget TextView getText

Introduction

In this page you can find the example usage for android.widget TextView getText.

Prototype

@ViewDebug.CapturedViewProperty
public CharSequence getText() 

Source Link

Document

Return the text that TextView is displaying.

Usage

From source file:com.gh4a.IssueLabelListActivity.java

private void clearOtherSelected(boolean all) {
    for (Map<String, Object> m : mAllLabelLayout) {
        LinearLayout llEdit2 = (LinearLayout) m.get("llEdit");
        TextView tvLabel2 = (TextView) m.get("tvLabel");
        View viewColor2 = (View) m.get("viewColor");
        Label label2 = (Label) m.get("label");
        if (all) {
            unselectLabel(tvLabel2, viewColor2, label2.getColor());
            llEdit2.setVisibility(View.GONE);
        } else {/*  w w  w.  ja  v  a 2  s .  c o  m*/
            if (!tvLabel2.getText().toString().equals(mSelectedLabel)) {
                unselectLabel(tvLabel2, viewColor2, label2.getColor());
                llEdit2.setVisibility(View.GONE);
            } else {
                llEdit2.setVisibility(View.VISIBLE);
            }
        }
    }
    if (mActionMode != null) {
        mActionMode.finish();
    }
    mSelectedLabel = null;
}

From source file:com.cypress.cysmart.RDKEmulatorView.MicrophoneEmulatorFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.rdk_microphone, container, false);
    mHexValue = (TextView) rootView.findViewById(R.id.hex_value);
    mConvertedTextValue = (TextView) rootView.findViewById(R.id.converted_text_value);
    final Button mGoogleVoiceConvert = (Button) rootView.findViewById(R.id.voiceconversion);
    Button mAPIChange = (Button) rootView.findViewById(R.id.apichange);
    mGoogleVoiceRecord = (Button) rootView.findViewById(R.id.voicerecord);
    /**/*  w  w  w. j  a v a  2 s.  c  om*/
     * Deleting the old recorded file and creating new one
     */
    mFilePCM = new File(mfilePCM);
    if (mFilePCM.exists()) {
        mFilePCM.delete();
    }
    try {
        mFilePCM.createNewFile();
    } catch (IOException e) {
        e.printStackTrace();
    }
    /**
    * Convert button click listner
    */
    mGoogleVoiceConvert.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String startRecord = getActivity().getResources().getString(R.string.record);
            mGoogleVoiceRecord.setText(startRecord);
            if (mFilePCM.length() != 0) {
                String mStoredAPIKey = Utils.getStringSharedPreference(getActivity(),
                        Constants.PREF_GOOGLE_API_KEY);
                if (RemoteControlEmulatorFragment.mIsrecording) {

                    RemoteControlEmulatorFragment.mIsrecording = false;
                    File file = new File(mfilePCM);
                    createWavFile(file, mfileWAV);
                }
                if (mStoredAPIKey.equalsIgnoreCase("")) {
                    showCustumAlert("", false);
                } else {
                    if (Utils.checkNetwork(getActivity())) {
                        googleVoiceConversion googleVoiceConversion = new googleVoiceConversion();
                        googleVoiceConversion.execute();
                    } else {
                        Toast.makeText(getActivity(), "Please check your internet connection",
                                Toast.LENGTH_SHORT).show();
                    }
                }
            } else {
                Toast.makeText(getActivity(), "No file recorded for conversion", Toast.LENGTH_SHORT).show();
            }

        }
    });
    /**
     * Record button click listner
     */
    mGoogleVoiceRecord.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            TextView recordStatus = (TextView) view;
            String startRecord = getActivity().getResources().getString(R.string.record);
            String stopRecord = getActivity().getResources().getString(R.string.record_stop);
            if (recordStatus.getText().toString().equalsIgnoreCase(startRecord)) {
                mFilePCM = new File(mfilePCM);
                if (mFilePCM.exists()) {
                    mFilePCM.delete();
                }
                try {
                    mFilePCM.createNewFile();
                    RemoteControlEmulatorFragment.mIsrecording = true;
                } catch (IOException e) {
                    e.printStackTrace();
                }
                recordStatus.setText(stopRecord);
            } else if (recordStatus.getText().toString().equalsIgnoreCase(stopRecord)) {
                recordStatus.setText(startRecord);
                RemoteControlEmulatorFragment.mIsrecording = false;
                File file = new File(mfilePCM);
                createWavFile(file, mfileWAV);
            }
        }
    });
    mAPIChange.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String mStoredAPIKey = Utils.getStringSharedPreference(getActivity(),
                    Constants.PREF_GOOGLE_API_KEY);
            Logger.e("mStoredAPIKey--" + mStoredAPIKey);
            showCustumAlert(mStoredAPIKey, true);
        }
    });
    return rootView;
}

From source file:com.adarshahd.indianrailinfo.donate.TrainDetails.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.id_btn_avail_next_7:
        Calendar cal = Calendar.getInstance();
        cal.set(cal.get(Calendar.YEAR), Integer.parseInt(mMonth), Integer.parseInt(mDay));
        cal.add(Calendar.DAY_OF_MONTH, 6);
        mDay = String.valueOf(cal.get(Calendar.DAY_OF_MONTH));
        mMonth = String.valueOf(cal.get(Calendar.MONTH));
        mDetails = null;//from w  w w  .j  a  v  a 2  s  .  c  om
        mFrameLayout = null;
        mFrameLayout = (FrameLayout) findViewById(R.id.id_fl_details);
        new GetAvail().execute();
        mDialog.setMessage("Fetching train availability . . .");
        mDialog.show();
        break;
    default:
        final TextView tv = (TextView) ((TableRow) v).getChildAt(1);
        if (tv.getText().toString().contains("Date")) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(TrainDetails.this);
        builder.setTitle("Book ticket");
        builder.setMessage(
                "You will be taken directly to IRCTC travel planner with all the information filled in it. Are you sure?");
        builder.setPositiveButton("Yes, Book ticket", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                String day = tv.getText().toString().split("-", 0)[0].trim();
                String month = tv.getText().toString().split("-", 0)[1].trim();
                if (day.length() < 2) {
                    day = "0" + day;
                }
                if (month.length() < 2) {
                    month = "0" + month;
                }
                Intent intent = new Intent(TrainDetails.this, IRCTCWeb.class);
                intent.setAction(IRCTCWeb.BOOK);
                intent.putExtra(TrainEnquiry.SRC, mSrc);
                intent.putExtra(TrainEnquiry.DST, mDst);
                intent.putExtra(TrainEnquiry.DAY_TRAVEL, day);
                intent.putExtra(TrainEnquiry.MONTH_TRAVEL, month);
                intent.putExtra(TrainEnquiry.CLS, mCls);
                //Toast.makeText(TrainDetails.this,"Day is: " + day + " Month is: " + month,Toast.LENGTH_LONG).show();
                dialog.dismiss();
                startActivity(intent);
            }
        });
        builder.setNegativeButton("No Thanks", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.create().show();
        break;
    }
}

From source file:com.android.tv.menu.MenuLayoutManager.java

private void setTempTitleView(TextView dest, TextView src) {
    dest.setVisibility(View.VISIBLE);
    dest.setText(src.getText());
    dest.setTranslationY(0.0f);//from  www  . j ava2s .  com
    if (src.getVisibility() == View.VISIBLE) {
        dest.setAlpha(src.getAlpha());
        dest.setScaleX(src.getScaleX());
        dest.setScaleY(src.getScaleY());
    } else {
        dest.setAlpha(0.0f);
        dest.setScaleX(1.0f);
        dest.setScaleY(1.0f);
    }
    View parent = (View) src.getParent();
    dest.setLeft(src.getLeft() + parent.getLeft());
    dest.setRight(src.getRight() + parent.getLeft());
    dest.setTop(src.getTop() + parent.getTop());
    dest.setBottom(src.getBottom() + parent.getTop());
}

From source file:com.facebook.samples.socialcafe.OrderDrinkFragmentActivity.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.order_drink, parent, false);
    getActivity().setTitle(R.string.place_order);

    TextView userName = (TextView) v.findViewById(R.id.story_order_message);
    userName.setText(getString(R.string.og_message,
            ((SocialCafeApplication) getActivity().getApplication()).userName, drink.getTitle()));

    ImageView userPic = (ImageView) v.findViewById(R.id.user_order_pic);
    userPic.setImageBitmap(((SocialCafeApplication) getActivity().getApplication()).userPic);

    TextView drinkTitle = (TextView) v.findViewById(R.id.drink_order_title);
    drinkTitle.setText(drink.getTitle());

    TextView drinkInfo = (TextView) v.findViewById(R.id.drink_order_info);
    drinkInfo.setText(drink.getInfo());//from   www  . j av a2  s . c o m

    final TextView userMessage = (TextView) v.findViewById(R.id.user_message);

    ImageView drinkImage = (ImageView) v.findViewById(R.id.drink_order_image);
    drinkImage.setImageResource(drink.getImageID());

    ImageButton orderButton = (ImageButton) v.findViewById(R.id.order_drink_button);
    orderButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dialog = ProgressDialog.show(getActivity(), "", getString(R.string.please_wait), true, true);
            Bundle params = new Bundle();
            params.putString("beverage", drink.getURL());
            if (userMessage.getText() != null && userMessage.getText().length() > 0) {
                params.putString("message", userMessage.getText().toString());
            }
            ((SocialCafeApplication) getActivity().getApplication()).asyncRunner.request("me/social-cafe:order",
                    params, "POST", new OrderDrinkPostListener(), ORDER_STATE);

        }
    });

    ImageButton tagFriendButton = (ImageButton) v.findViewById(R.id.tag_friends);
    tagFriendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(getActivity()).setMessage(R.string.tag_friends_not_supported)
                    .setPositiveButton(R.string.ok, null).show();
        }
    });

    ImageButton tagLocationButton = (ImageButton) v.findViewById(R.id.tag_location);
    tagLocationButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(getActivity()).setMessage(R.string.tag_location_not_supported)
                    .setPositiveButton(R.string.ok, null).show();
        }
    });

    ImageButton addPhotoButton = (ImageButton) v.findViewById(R.id.add_photo);
    addPhotoButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(getActivity()).setMessage(R.string.add_photo_not_supported)
                    .setPositiveButton(R.string.ok, null).show();
        }
    });

    return v;
}

From source file:com.thalmic.android.sample.helloworld.HelloWorldActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hello_world);

    sensorManager = (SensorManager) this.getSystemService(SENSOR_SERVICE);
    vector = sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR);
    acc = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mag = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);

    mLockStateView = (TextView) findViewById(R.id.lock_state);
    mTextView = (TextView) findViewById(R.id.text);
    mRoll = (TextView) findViewById(R.id.roll);
    mPitch = (TextView) findViewById(R.id.pitch);
    mYaw = (TextView) findViewById(R.id.yaw);

    EditText videoip = (EditText) findViewById(R.id.videoip);
    videoip.setOnEditorActionListener(new OnEditorActionListener() {
        @Override//from w ww  .j  av  a2 s  . c  om
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                ip = v.getText().toString();
                startVideo();
                handled = true;
            }

            return handled;
        }
    });

    EditText connect = (EditText) findViewById(R.id.connect);
    connect.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_SEND) {

                try {
                    String address = v.getText().toString();
                    client = new Client(("tcp://" + address + ":6767"), "client");

                    try {
                        client.send("runtime", "getUptime");
                        //client.send("runtime", "start", "arduino", "Arduino");
                        //client.send("runtime", "start", "servo01", "Servo");
                    } catch (IOException e) {
                        e.printStackTrace();
                    }

                } catch (URISyntaxException e) {
                    e.printStackTrace();
                }
                handled = true;
            }
            return handled;
        }
    });

    EditText comPort = (EditText) findViewById(R.id.comport);
    comPort.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                String address = v.getText().toString();
                if (client != null) {
                    try {
                        client.send("arduino", "connect", address);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                handled = true;
            }
            return handled;
        }
    });

    final Button calibrate = (Button) findViewById(R.id.calibrate);
    calibrate.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            //
            // Perform action on click
            if (client != null) {
                try {
                    client.send("oculus", "calibrate");
                } catch (IOException e) {
                    e.printStackTrace();
                }

            }
        }
    });

    ToggleButton toggleCardboard = (ToggleButton) findViewById(R.id.cardboard);
    toggleCardboard.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                cardboardMode = true;
            } else {
                cardboardMode = false;
            }
        }
    });

    ToggleButton toggleHeadTracking = (ToggleButton) findViewById(R.id.headTrackingButton);
    toggleHeadTracking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                headTrackingMode = true;
            } else {
                headTrackingMode = false;
            }
        }
    });

    // First, we initialize the Hub singleton with an application identifier.
    Hub hub = Hub.getInstance();
    if (!hub.init(this, getPackageName())) {
        // We can't do anything with the Myo device if the Hub can't be initialized, so exit.
        Toast.makeText(this, "Couldn't initialize Hub", Toast.LENGTH_SHORT).show();
        finish();
        return;
    }
    // Next, register for DeviceListener callbacks.
    hub.addListener(mListener);
    //hub.attachToAdjacentMyo();
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
}

From source file:com.app.jdy.activity.GoldActivity.java

private void initView() {
    mContext = this;
    notice_tip = getResources().getString(R.string.no_more_product);
    linearLayout_net_error = (LinearLayout) findViewById(R.id.linearLayout_net_error);
    linearLayout_content = (LinearLayout) findViewById(R.id.linearLayout_content);
    //imageLayout_net_error = (LinearLayout) findViewById(R.id.imageLayout_net_error);
    back_img = (ImageView) findViewById(R.id.back_img);
    title_tv = (TextView) findViewById(R.id.title_tv);
    right_img = (ImageView) findViewById(R.id.right_img);

    right_img.setBackgroundResource(R.drawable.search);
    right_img.setOnClickListener(this);
    if (flag == 0) {
        request_url = URLs.GETPRODUCTLIST;
        title_tv.setText("");
        back_img.setVisibility(View.INVISIBLE);
    } else if (flag == 1) {
        request_url = URLs.FOLLOWLIST_URL;
        title_tv.setText("?");
        back_img.setVisibility(View.VISIBLE);

        menu = new SlidingMenu(this);
        menu.setMode(SlidingMenu.RIGHT);
        menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        menu.setShadowWidthRes(R.dimen.shadow_width);
        menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        menu.setFadeDegree(0.35f);/*from  w  ww . j a v  a2  s  .c o  m*/
        menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
        View view = LayoutInflater.from(mContext).inflate(R.layout.search_popuwindow, null);
        edit_search = (EditText) view.findViewById(R.id.edit_search);
        lv_search = (ListView) view.findViewById(R.id.lv_search);
        searchListViewAdapter = new SearchListViewAdapter(strs, mContext);
        lv_search.setAdapter(searchListViewAdapter);
        lv_search.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
                TextView tv = (TextView) view.findViewById(R.id.tv_search);
                Intent intent = new Intent();
                intent.setAction("org.jdy.action.LV_SEARCH_BROADCAST");
                intent.putExtra("search_ProdType", CommonUtils.CodeForName(tv.getText().toString()));
                intent.putExtra("reqFlag", 1);
                sendBroadcast(intent);
                menu.showContent();
            };
        });
        btn_search = (Button) view.findViewById(R.id.btn_search);
        btn_search.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                CommonUtils.HideKeyBoard(mContext, edit_search);
                Intent intent = new Intent();
                intent.setAction("org.jdy.action.KEYWORD_SEARCH_BROADCAST");
                intent.putExtra("search_keyWord", edit_search.getText().toString());
                intent.putExtra("reqFlag", 1);
                sendBroadcast(intent);
                menu.showContent();
            }
        });
        menu.setMenu(view);
        slidingMenuLayout = (LinearLayout) findViewById(R.id.slidingmenu);
        final Bitmap bitmap = BitmapUtils.readBitMap(mContext, R.drawable.sliding_bg,
                slidingMenuLayout.getMeasuredWidth(), slidingMenuLayout.getMeasuredHeight());
        slidingMenuLayout.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                slidingMenuLayout.getViewTreeObserver().removeOnPreDrawListener(this);
                BitmapUtils.blur(bitmap, slidingMenuLayout);
                return true;
            }
        });
    }

    back_img.setOnClickListener(this);
    order_layout = (LinearLayout) findViewById(R.id.order_layout);
    line_minSubsAmount = (LinearLayout) findViewById(R.id.line_minSubsAmount);
    line_expeAnnuRevnue = (LinearLayout) findViewById(R.id.line_expeAnnuRevnue);
    line_period = (LinearLayout) findViewById(R.id.line_period);

    orderLayouts.add(line_minSubsAmount);
    orderLayouts.add(line_expeAnnuRevnue);
    orderLayouts.add(line_period);
    line_expeAnnuRevnue.setOnClickListener(this);
    line_minSubsAmount.setOnClickListener(this);
    line_period.setOnClickListener(this);
    ATListview = (MyListView) findViewById(R.id.gold_Listview);
    ATListview.setOnItemClickListener(new onClickview());
    listViewAdapter = new ListViewAdapter(mContext, productList);
    ATListview.setAdapter(listViewAdapter);

    mPullRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.gold_pull_refresh_scrollview);
    /**
     * 
     */
    lvSearchReceiver = new LV_SEARCH_BROADCAST();
    IntentFilter intentFilter2 = new IntentFilter("org.jdy.action.LV_SEARCH_BROADCAST");
    registerReceiver(lvSearchReceiver, intentFilter2);
    keyWordSearchReceiver = new KeyWordSearchReceiver();
    IntentFilter intentFilter3 = new IntentFilter("org.jdy.action.KEYWORD_SEARCH_BROADCAST");
    registerReceiver(keyWordSearchReceiver, intentFilter3);
    /**
     * ?
     */
    mPullRefreshScrollView.setOnRefreshListener(new OnRefreshListener<ScrollView>() {
        @Override
        public void onRefresh(PullToRefreshBase<ScrollView> refreshView) {
            pageNumber++;
            notice_tip = getResources().getString(R.string.no_more_product);
            new QueryProductListTask().execute();
            mPullRefreshScrollView.onRefreshComplete();
        }
    });

    new QueryProductListTask().execute();
}

From source file:com.chenl.widgets.flippablestackview.indicator.OrientedPagerSlidingTabLayout.java

private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        View childView = tabsContainer.getChildAt(i);
        if (tabBackgroundResId == -1) {
            childView.setBackgroundDrawable(mTabBackgroundRes);
        } else {// w w  w .j  a va 2 s  .c  o m
            childView.setBackgroundResource(tabBackgroundResId);
        }
        if (childView instanceof TextView) {
            TextView tab = (TextView) childView;
            tab.setTextSize(tabTextSize);
            tab.setTextColor(tabTextColor);
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }
            }
        }
    }

}

From source file:com.he5ed.lib.cloudprovider.picker.PickerFragment.java

private View swapOutEmptyViewDetails(View oldView, View newView) {
    if (oldView == null && newView == null) {
        return null;
    } else if (oldView == null) {
        return newView;
    } else if (newView == null) {
        return oldView;
    }//from w  ww .j a  va  2  s  .c om

    ImageView oldIcon = (ImageView) oldView.findViewById(R.id.empty_icon_image_view);
    TextView oldTitle = (TextView) oldView.findViewById(R.id.empty_title_text_view);
    TextView oldDetail = (TextView) oldView.findViewById(R.id.empty_detail_text_view);

    ImageView newIcon = (ImageView) newView.findViewById(R.id.empty_icon_image_view);
    TextView newTitle = (TextView) newView.findViewById(R.id.empty_title_text_view);
    TextView newDetail = (TextView) newView.findViewById(R.id.empty_detail_text_view);
    newIcon.setImageDrawable(oldIcon.getDrawable());
    newTitle.setText(oldTitle.getText());
    newDetail.setText(oldDetail.getText());

    return newView;
}

From source file:com.android.nsboc.ComposeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mItem != null) {
        switch (mItem.id + "") {
        case "1":
            mRootView = inflater.inflate(R.layout.form_unlicensed, container, false);
            break;
        case "2":
            mRootView = inflater.inflate(R.layout.form_salon, container, false);
            break;
        }//w w w  .  j  av  a2s.  com
    }

    showCurrentDateInEditText();

    ToggleButton complianceToggle = (ToggleButton) mRootView.findViewById(R.id.compliance_toggle);
    if (complianceToggle != null) {
        final LinearLayout complianceContainer = (LinearLayout) mRootView
                .findViewById(R.id.compliance_container);

        complianceToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (!isChecked) {
                    complianceContainer.setVisibility(View.VISIBLE);

                    final LinearLayout complianceLayout = (LinearLayout) View.inflate(getActivity(),
                            R.layout.compliance_layout, null);

                    Spinner violationTypeSpinner = (Spinner) complianceLayout
                            .findViewById(R.id.violation_type_spinner);
                    violationTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                            switch (position) {
                            case 0:
                                complianceLayout.findViewById(R.id.type_citation_container)
                                        .setVisibility(View.VISIBLE);
                                break;
                            case 1:
                                complianceLayout.findViewById(R.id.type_citation_container)
                                        .setVisibility(View.GONE);
                                break;
                            }
                        }

                        @Override
                        public void onNothingSelected(AdapterView<?> parent) {
                        }
                    });

                    ToggleButton anotherToggle = (ToggleButton) complianceLayout
                            .findViewById(R.id.compliance_toggle);
                    anotherToggle.setOnCheckedChangeListener(getNextToggleListener(complianceLayout));

                    complianceContainer.addView(complianceLayout);
                } else {
                    complianceContainer.setVisibility(View.GONE);
                }
            }
        });
    }

    ToggleButton emailToggle = (ToggleButton) mRootView.findViewById(R.id.emailTo_toggle);
    if (emailToggle != null) {
        final LinearLayout emailLayout = (LinearLayout) mRootView.findViewById(R.id.emailTo_layout);

        emailToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    emailLayout.setVisibility(View.VISIBLE);
                } else {
                    emailLayout.setVisibility(View.GONE);
                }
            }
        });
    }

    final TextView noticeTextView = (TextView) mRootView.findViewById(R.id.notice_textview);
    if (noticeTextView != null) {
        noticeTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (noticeTextView.getCurrentTextColor() == Color.BLACK) {
                    noticeTextView.setText(R.string.civil_citation_header);
                    noticeTextView.setTextColor(Color.parseColor("#17405e"));
                    noticeTextView.setText(Html.fromHtml("<u>" + noticeTextView.getText() + "</u>"));
                    mRootView.findViewById(R.id.civil_citation).requestFocus();
                } else {
                    noticeTextView.setText(R.string.civil_citation_notice);
                    noticeTextView.setMaxLines(Integer.MAX_VALUE);
                    noticeTextView.setTextColor(Color.BLACK);
                    noticeTextView.setText(
                            noticeTextView.getText().toString().replace("<u>", "").replace("</u>", ""));
                }
            }
        });
    }

    Spinner stateSpinner = (Spinner) mRootView.findViewById(R.id.state);
    if (stateSpinner != null) {
        stateSpinner.setSelection(27);
    }

    return mRootView;
}