Java Code Examples for android.widget.TextView#setDrawingCacheEnabled()

The following examples show how to use android.widget.TextView#setDrawingCacheEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FaceActivity.java    From Android-HowOld with MIT License 6 votes vote down vote up
private Bitmap buildAgeBitmap(int age, boolean isMale) {

		TextView tv = (TextView) mWaitting.findViewById(R.id.id_age_gender);
		tv.setText(age + "");
		if (isMale) {
			tv.setCompoundDrawablesWithIntrinsicBounds(getResources()
					.getDrawable(R.drawable.male), null, null, null);

		} else {
			tv.setCompoundDrawablesWithIntrinsicBounds(getResources()
					.getDrawable(R.drawable.female), null, null, null);
		}
		tv.setDrawingCacheEnabled(true);
		Bitmap bitmap = Bitmap.createBitmap(tv.getDrawingCache());
		tv.destroyDrawingCache();

		return bitmap;
	}