How to determine the amount of characters that will fit into a TextView

by » Fri, 10 Apr 2009 06:11:55 GMT

Sponsored Links
 I am trying to place only the exact amount of data into a TextView but
I need to know how much it can hold.  Is there a way to do this based
on it's height, width and the textsize?

How to determine the amount of characters that will fit into a TextView

by nEx.Software » Fri, 10 Apr 2009 21:05:25 GMT

 I'd say if you know the text you want to put into the TextView, you
should be able to measure the text and compare to the size of the
TextView... In the API Demos, there is a measure text sample. I'd
start there.

On Apr 9, 3:11pm, "" <>


Sponsored Links

Other Threads

1. How to add a refresh button to a webview app?

Hey guys, i'm very new to this. I only have basic XHTML knowledge and
im looking into getting more into android development so ive been
reading the tutorials but i cant find a tutorial on how to create a
menu and then make the menu button refresh my webview content.'s my current code. i was wondering if someone could show
me how it should look to make it when i hit the menu button and then
how to make the menu button do a refresh of my web content. thanks in
advance i think getting to look how it is done may help me understand
a lot of whats been confusing me ive looked everywhere and i just get

my code: -
package com.brybam.webview;

import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class webview extends Activity {
        /** Called when the activity is first created. */
        WebView webview;
    public void onCreate(Bundle savedInstanceState) {
        webview = (WebView) findViewById(;
        webview.setWebViewClient(new webviewClient());
        private class webviewClient extends WebViewClient {
            public boolean shouldOverrideUrlLoading(WebView view,
String url)
                return true;
        public boolean onKeyDown(int keyCode, KeyEvent event) {
            if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack
()) {
                return true;
            return super.onKeyDown(keyCode, event);

main.xml -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="


AndroidManifest.xml -
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
      android:versionName="3" android:versionCode="3">
    <application android:icon="@drawable/icon"
        <activity android:name=".webview"
                <action android:name="android.intent.action.MAIN" />
android:name="android.intent.category.LAUNCHER" />

    <uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.INTERNET" />


2. Connect Android to Android or PC


 I am trying to do a little game for android, but I wanted several
players to play using a PC and another phone.
 How can I send and rreceive information from other phones or PCs?
 I really just want to know my possibilities, can I do it through
HTTP? Is there a better way if I know which PC to connect to?

Thank you,


3. Which sdk / emulator vers for moto cliq ?

4. Text file

5. Android development with ADK in Eclipse on Snow Leopard

6. colored logcat for windows

7. Android 2.0 sample codes