FileDocCategorySizeDatePackage
GlyphCacheActivity.javaAPI DocAndroid 5.1 API2773Thu Mar 12 22:22:44 GMT 2015com.android.test.hwui

GlyphCacheActivity

public class GlyphCacheActivity extends android.app.Activity

Fields Summary
private static final String
mCharacterSet
private int
mTotalChars
Constructors Summary
Methods Summary
private java.lang.StringcreateString(int length)

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            sb.append(mCharacterSet.charAt((int)(Math.random() * mCharacterSet.length())));
        }
        return sb.toString();
    
private android.widget.TextViewcreateTextView()

        TextView textview = new TextView(this);
        textview.setTextSize(6 + (int) (Math.random() * 5) * 10);
        textview.setTextColor(0xff << 24 | (int) (Math.random() * 255) << 16 |
                (int) (Math.random() * 255) << 8 | (int) (Math.random() * 255) << 16);
        textview.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        int numChars = 5 + (int) (Math.random() * 10);
        mTotalChars += numChars;
        textview.setText(createString(numChars));

        return textview;
    
protected voidonCreate(android.os.Bundle savedInstanceState)


    
        
        super.onCreate(savedInstanceState);

        ScrollView scrollView = new ScrollView(this);
        scrollView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.VERTICAL);
        layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        scrollView.addView(layout);

        while (mTotalChars < 10000) {
            layout.addView(createTextView());
        }
        setContentView(scrollView);