把TextView转换成Bitmap报空指针异常
TextView tv = (TextView) mWaitting.findViewById(R.id.id_age_and_gender); tv.setText(age+""); Log.d("TAG","here"); 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;
Bitmap bitmap = Bitmap.createBitmap(tv.getDrawingCache());这个位置报空指针异常,怎么办