TextSwitcher setText - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TextSwitcher setText method.

This code example shows how to use the following methods:getContext, setText, setInAnimation, setOutAnimation, setFactory
 
    /** 
     * Initializes the score TextSwitcher for the specified {@code textSwitcher}. 
     */ 
    private void initializeTextSwitcher(final TextSwitcher textSwitcher) {
        textSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
            @Override 
            public View makeView() {
                TextView textView = new TextView(textSwitcher.getContext());
                textView.setTextSize(26);
                return textView;
            } 
        }); 
 
        textSwitcher.setInAnimation(AnimationUtils.loadAnimation(textSwitcher.getContext(), android.R.anim.fade_in));
        textSwitcher.setOutAnimation(AnimationUtils.loadAnimation(textSwitcher.getContext(), android.R.anim.fade_out));
        textSwitcher.setText("1");
    } 
 
} 

6
CodeRank
This code example shows how to use the following methods:setText
        mCounter++;
        updateCounter(); 
    } 
 
    private void updateCounter() { 
        mSwitcher.setText(String.valueOf(mCounter));
    } 
 
    public View makeView() {
        TextView t = new TextView(this);
        t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
        t.setTextSize(36);
        return t;
    } 
} 
6
CodeRank
This code example shows how to use the following methods:setText, getInAnimation, getOutAnimation, setInAnimation, setOutAnimation
This code example shows how to use the following methods:setText
 
	@Override 
	public void run() { 
		// TODO Auto-generated method stub 
		try { 
			switcher.setText(comments[commentIndex++]);
			if (commentIndex >= comments.length) {
				commentIndex = 0;
			} 
		} finally { 
			switcherCommentsHandler.postDelayed(this, 5 * 1000);
		} 
 
	} 
 
	@Override 
	public void onItemSelected(AdapterView<?> parent, View view, int position,
			long id) {
		// TODO Auto-generated method stub 
 
3
CodeRank
This code example shows how to use the following methods:setText
    if (!s.equals(mHour)) {
        mSwitchHour.setText(mHour = s);
    } 
    s = DateFormat.format(mOrient == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE ? "mm:" : "mm", mCal).toString();
    if (!s.equals(mMin)) {
        mSwitchMin.setText(mMin = s);
    } 
    s = DateFormat.format("ss",mCal).toString();
    if (!s.equals(mSec)) {
        mSwitchSec.setText(mSec = s);
    } 
  } 
 
  public View makeView() {
    return mInflater.inflate(R.layout.bedclock_text, null);
  } 
 
  public void onClick(View v) { finish(); }
 
  @Override 
3
CodeRank
This code example shows how to use the following methods:setText
		String combined = applicationlabel;
		if (!TextUtils.isEmpty(versionname)) {
			combined += " " + versionname;
		} 
		 
        mProgramNameAndVersionText.setText(combined);
	} 
 
	/** 
	 * Get application label. 
	 *  
	 * @param intent The intent from which to fetch the information. 
	 */ 
	protected String getApplicationLabel(final String packagename, final Intent intent) {
		String applicationlabel = null;
		if (intent.hasExtra(AboutIntents.EXTRA_APPLICATION_LABEL)
				&& intent.getStringExtra(AboutIntents.EXTRA_APPLICATION_LABEL) 
					!= null) { 
			applicationlabel = intent.getStringExtra(AboutIntents.EXTRA_APPLICATION_LABEL);
		} else { 
3
CodeRank
This code example shows how to use the following methods:setText
		switchCommentHandler.removeCallbacks(this);
	} 
 
	public void run() { 
		try { 
			switcher.setText(comments[commentIndex++]);
			if (commentIndex >= comments.length) {
				commentIndex = 0;
			} 
		} finally { 
			switchCommentHandler.postDelayed(this, 5 * 1000l);
		} 
	} 
 
	@Override 
	public void onItemSelected(AdapterView<?> parent, View view, int position,
			long id) {
		photo.setImageDrawable(Utils.LoadImageFromWebOperations((String) photos
				.getAdapter().getItem(position)));
	} 
4
CodeRank
This code example shows how to use the following methods:setText
    } 
 
    private void addAndCheckForUnlock(EntryCode event) {
        String eventString = getEventString(event);
         
        textSwitcher.setText(eventString);
         
        queue.add(event);
        guestQueue.add(event);
        if (isCorrectCode()) { 
            unlock(); 
        } else if (isGuestCode()) { 
            guestUnlocked();  
        } 
    } 
 
    private String getEventString(EntryCode event) {
         
        switch(event) {
            case FLING_LEFT:
4
CodeRank
This code example shows how to use the following methods:setText
	private TextSwitcher voiceScore;
	private TextView textViewInfo;
 
	@Override 
	public void onClick(View arg0) {
		voiceScore.setText(String.valueOf(alAudioRecord.getVoice()));
	} 
 
 
	@Override 
	public boolean onLongClick(View arg0) {
		// TODO Auto-generated method stub 
		Log.i("mmmm", "µã»÷ÁË");
		//³õʼ»¯ 
		this.changetext(0);
		audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, 8000,
				AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, recBufSize);
		alAudioRecord = new AlAudioRecord(
				audioRecord, seconds, recBufSize);
		 
4
CodeRank
This code example shows how to use the following methods:setText
		updateCounter(); 
	} 
 
	private void updateCounter() { 
		term = techArray[mCounter];
		textSwitcher.setText(term);
	} 
 
	@Override 
	public View makeView() {
		TextView t = new TextView(this);
		t.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
		t.setTextSize(36);
		return t;
	} 
 
	public void groovyImageClicked(View v) {
		String url = getResources().getString(R.string.groovy_org);
		startBrowserWithUrl(url);
	} 
4
CodeRank

Related TextSwitcher setText Questions & Answers:

setText Method Overview
Sets the text of the next view and switches to the next view.
See Code Examples for other Android TextSwitcher Methods: