截取屏幕图像返回Bitmap的函数
??? Handler mMyHandler = new Handler(){
??????? @Override
??????? public void handleMessage(Message msg) {
??????? ??? switch(msg.what){
??????? ??? case 1:
??????? ??? ??? try {
??? ??? ??? ??? ??? mV.setDrawingCacheEnabled(false);
??? ??? ??? ??? } catch (Exception e) {
??? ??? ??? ??? ??? // TODO Auto-generated catch block
??? ??? ??? ??? ??? e.printStackTrace();
??? ??? ??? ??? ??? Log.d(TAG,"mMyHandler:catch (Exception e)");
??? ??? ??? ??? }
??????? ??? ??? Log.d(TAG,"case 1:");
??????? ??? ??? break;
??????? ??? ??? default:
??????? ??? ??? ??? break;
??????? ??? }
??????? }
??? };
??? View mV;
??? public Bitmap takeScreenShot(View view){
??? ??? Log.d(TAG,"view.isDrawingCacheEnabled()="+view.isDrawingCacheEnabled());
??? ??? mV=view;
??? ??? if(!view.isDrawingCacheEnabled()){
??? ??? ??? view.setDrawingCacheEnabled(true);//之后要置为false才行,以便以后继续抓图。
??? ??? }
??? ??? view.buildDrawingCache();
??? ??? Bitmap bitmap = view.getDrawingCache();
??? ??? Bitmap bitmap2 = Bitmap.createBitmap(bitmap);
??? ??? if(bitmap==null){
??? ??? ??? Log.d("lee","bitmap==null");
??? ??? }else{
??? ??? ??? Log.d("lee","else");
??? ??? ??? return bitmap2;
??? ??? }??? ???
??? ??? return null;
??? }