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:astuetz.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            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  w  w  w  .  j av a  2 s  . c  om*/
            }
            if (i == selectedPosition) {
                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}

From source file:com.app.sample.chatting.widget.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case
            // is made manually if we are on a
            // pre-ICS-build
            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   w  w  w .  j a v  a  2 s  . c om
            }
        }
    }

}

From source file:gr.scify.newsum.ui.ViewActivity.java

private void share() {

    TextView title = (TextView) findViewById(R.id.title);
    String sTitle = title.getText().toString();
    Intent share = new Intent(this, ShareBarActivity.class);
    share.putExtra("summaryF", "" + Html.fromHtml("<h2>" + sTitle + "</h2><br>" + pText));
    share.putExtra("summaryT", sTitle);

    this.startActivityForResult(share, 0);

}

From source file:com.nonstop.android.SoC.BluetoothChat.BluetoothChat.java

private void setupChat() {
    Log.d(TAG, "setupChat()");

    // Initialize the array adapter for the conversation thread
    mConversationArrayAdapter = new ArrayAdapter<String>(this, R.layout.message);
    mConversationView = (ListView) findViewById(R.id.in);
    mConversationView.setAdapter(mConversationArrayAdapter);

    // Initialize the compose field with a listener for the return key
    mOutEditText = (EditText) findViewById(R.id.edit_text_out);
    mOutEditText.setOnEditorActionListener(mWriteListener);

    // Initialize the send button with a listener that for click events
    mSendButton = (Button) findViewById(R.id.button_send);
    mSendButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            // Send a message using content of the edit text widget
            TextView view = (TextView) findViewById(R.id.edit_text_out);
            String message = view.getText().toString();
            sendMessage(message);//from   www .  j a va  2  s .  co  m
        }
    });
    mTurnLeftButton = (Button) findViewById(R.id.button_turnleft);
    mTurnLeftButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {

            mChatService.mGlasOData.setDirection(Direction.LEFT);
            sendMessage(mChatService.mGlasOData.makePacket());
        }
    });
    mTurnRightButton = (Button) findViewById(R.id.button_turnright);
    mTurnRightButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mChatService.mGlasOData.setDirection(Direction.RIGHT);
            sendMessage(mChatService.mGlasOData.makePacket());
        }
    });
    mNormalButton = (Button) findViewById(R.id.button_normal);
    mNormalButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mChatService.mGlasOData.setDirection(Direction.NORMAL);
            sendMessage(mChatService.mGlasOData.makePacket());
        }
    });

    mNoAlarmButton = (Button) findViewById(R.id.button_no_alarm);
    mNoAlarmButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mChatService.mGlasOData.setAlarm_(Alarm.NOUSE);
            sendMessage(mChatService.mGlasOData.makePacket());
        }
    });
    mAroundAlarmButton = (Button) findViewById(R.id.button_around_alarm);
    mAroundAlarmButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mChatService.mGlasOData.setAlarm_(Alarm.AROUND);
            sendMessage(mChatService.mGlasOData.makePacket());
        }
    });
    mOnAlarmButton = (Button) findViewById(R.id.button_on_alarm);
    mOnAlarmButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mChatService.mGlasOData.setAlarm_(Alarm.ONTIME);
            sendMessage(mChatService.mGlasOData.makePacket());
        }
    });
    mOnTimeButton = (Button) findViewById(R.id.button_ontime);
    mOnTimeButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mChatService.mGlasOData.setOnTime(OnTime.ON);
            sendMessage(mChatService.mGlasOData.makePacket());
            mChatService.mGlasOData.setOnTime(OnTime.OFF);
        }
    });
    mPhotoButton = (Button) findViewById(R.id.button_photo);
    mPhotoButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {

            if (!Utility.mFacebook.isSessionValid()) {
                // Util.showAlert(this, "Warning",
                // "You must first log in.");
            } else {
                /*
                 * Source tag: upload_photo_tag
                 */
                dialog = ProgressDialog.show(BluetoothChat.this, "", getString(R.string.please_wait), true,
                        true);
                Bundle params = new Bundle();
                params.putString("url", "http://www.facebook.com/images/devsite/iphone_connect_btn.jpg");
                params.putString("caption", "FbAPIs Sample App photo upload");
                Utility.mAsyncRunner.request("me/photos", params, "POST", new PhotoUploadListener(), null);
            }
        }
    });

    mRadioGroup = (RadioGroup) findViewById(R.id.radioGroup1);
    mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        public void onCheckedChanged(RadioGroup arg0, int arg1) {
            if (arg1 == R.id.radio_exceed) {

                mChatService.mGlasOData.setExceed(Exceed.EXCEED);
            } else if (arg1 == R.id.radio_exceedhigh) {

                mChatService.mGlasOData.setExceed(Exceed.EXCEEDHIGH);
            } else if (arg1 == R.id.radio_normalspeed) {
                mChatService.mGlasOData.setExceed(Exceed.NORMALSPEED);
            }
            sendMessage(mChatService.mGlasOData.makePacket());
        }
    });

    mStatusCheckBox = (CheckBox) findViewById(R.id.checkBox_status);
    mStatusCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                mChatService.mGlasOData.setStatus(Status.WRONG);
            } else {
                mChatService.mGlasOData.setStatus(Status.NORMAL);
            }
        }
    });

    mNaviToggle = (ToggleButton) findViewById(R.id.toggle_navi);
    mNaviToggle.setOnCheckedChangeListener(new ToggleButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                if (D)
                    Log.e(TAG, "++ NAVI ON ++");
                mChatService.navi_stat_ = 1;

            } else {
                if (D)
                    Log.e(TAG, "++ NAVI OFF ++");
                mChatService.navi_stat_ = 0;

            }
        }
    });
    mHeartbeatToggle = (ToggleButton) findViewById(R.id.toggle_Heartbeat);
    mHeartbeatToggle.setOnCheckedChangeListener(new ToggleButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                if (D)
                    Log.e(TAG, "++ HEARTBEAT ON ++");
                mChatService.heartbeat_stat_ = 1;
            } else {
                if (D)
                    Log.e(TAG, "++ HEARTBEAT OFF ++");
                mChatService.heartbeat_stat_ = 0;
            }
            if (mChatService.heartbeat_stat_ == 0 && mChatService.distance_stat_ == 0
                    && mChatService.speed_stat_ == 0) {
                mChatService.sens_stat_ = 0;
            } else {
                mChatService.sens_stat_ = 1;
            }
        }
    });

    mHeartbeat = (SeekBar) findViewById(R.id.seekBar_Heartbeat);
    mHeartbeat.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mChatService.mGlasOData.setHeartbeat_(progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });

    mSpeedToggle = (ToggleButton) findViewById(R.id.toggle_Velocity);
    mSpeedToggle.setOnCheckedChangeListener(new ToggleButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                if (D)
                    Log.e(TAG, "++ SpeedSens ON ++");
                mChatService.speed_stat_ = 1;
            } else {
                if (D)
                    Log.e(TAG, "++ SpeedSens OFF ++");
                mChatService.speed_stat_ = 0;
            }
            if (mChatService.heartbeat_stat_ == 0 && mChatService.distance_stat_ == 0
                    && mChatService.speed_stat_ == 0) {
                mChatService.sens_stat_ = 0;
            } else {
                mChatService.sens_stat_ = 1;
            }
        }
    });

    mSpeed = (SeekBar) findViewById(R.id.seekBar_Velocity);
    mSpeed.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mChatService.mGlasOData.setVelocity_(progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });

    mDistanceToggle = (ToggleButton) findViewById(R.id.toggle_Distance);
    mDistanceToggle.setOnCheckedChangeListener(new ToggleButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                if (D)
                    Log.e(TAG, "++ Distance ON ++");
                mChatService.distance_stat_ = 1;
            } else {
                if (D)
                    Log.e(TAG, "++ Distance OFF ++");
                mChatService.distance_stat_ = 0;
            }
            if (mChatService.heartbeat_stat_ == 0 && mChatService.distance_stat_ == 0
                    && mChatService.speed_stat_ == 0) {
                mChatService.sens_stat_ = 0;
            } else {
                mChatService.sens_stat_ = 1;
            }
        }
    });

    mDiatance = (SeekBar) findViewById(R.id.seekBar_Distance);
    mDiatance.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mChatService.mGlasOData.setDistance_(progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });
    // Initialize the BluetoothChatService to perform bluetooth connections
    mChatService = new BluetoothChatService(this, mHandler);

    // Initialize the buffer for outgoing messages
    mOutStringBuffer = new StringBuffer("");
}

From source file:com.ctguer.controller.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }// www.  j  a v a  2  s. c  o  m
            }
            if (i == selectedPosition) {

                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}

From source file:com.hpuvoice.view.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made
            // manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }//w  ww . j  a  va2s.c o m
            }
        }
    }

}

From source file:com.astuetz.PagerSlidingTabStripExtendsBak.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }/* w w  w  .ja  v a  2  s.  c  o  m*/
            }
            /*  ------------------  2016-4-12*/
            if (mSelectedPosition == i) {
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize);
                tab.setTextColor(selectedTabTextColor);
            }
            /* ---------------------------  2016-4-12*/
        }
    }

}

From source file:gr.scify.newsum.ui.ViewActivity.java

private void Sendmail() {
    TextView title = (TextView) findViewById(R.id.title);
    String emailSubject = title.getText().toString();

    // track the Send mail action
    if (getAnalyticsPref()) {
        EasyTracker.getTracker().sendEvent(SHARING_ACTION, "Send Mail", emailSubject, 0l);
    }/*  w  ww. jav a2s .  c  om*/
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("text/html");
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "NewSum app : " + emailSubject);
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(sText));
    startActivity(Intent.createChooser(emailIntent, "Email:"));
}

From source file:com.geekband.huzhouapp.custom.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(getResources().getColor(R.color.tab_color));

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }/*w  w w  . ja  v a  2 s  .c o m*/
            }
        }
    }

}

From source file:app.hanks.com.conquer.view.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case
            // is made manually if we are on a
            // pre-ICS-build
            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 ww  w. j  a  v  a 2 s  .c om*/
            }
            if (i == selectedPosition) {
                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}