安卓開發常用的工具類

 最近一直在忙項目,今天終於抽出時間來總結一下。下面吧自己覺得挺常用的一些工具類貼出來總結一下、分享一下。其中有在網上找的也有自己寫的也有自己改的。

1.登錄註冊時驗證手機號是否合法
/**
* Created by liuzongxin on 2015/11/14.
*/
public class CommonUtils {
private static Gson mGson;
private static final String GSON_FORMAT = “yyyy-MM-dd HH:mm:ss”;
public static SimpleDateFormat formatDate = new SimpleDateFormat(“yyyy-MM-dd”, Locale.getDefault());
public static SimpleDateFormat formatDay = new SimpleDateFormat(“d”, Locale.getDefault());
public static SimpleDateFormat formatMonthDay = new SimpleDateFormat(“M-d”, Locale.getDefault());
public static SimpleDateFormat formatDateTime = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”, Locale.getDefault());

/**
 * 中國移動擁有號碼段爲:134 135 136 137 138 139 147 150 151 152 157 158 159 178 182 183 184 187 188
 * 19個號段 中國聯通擁有號碼段爲:130 131 132 145 155 156 175 176 185 186;10個號段
 * 中國電信擁有號碼段爲:133 153 177 180 181 189;6個號碼段
 * 虛擬運營商:170
 */
private static String regMobileStr = "^1(([3][456789])|([4][7])|([5][012789])|([7][8])|([8][23478]))[0-9]{8}$";
private static String regUnicomStr = "^1(([3][012])|([4][5])|([5][56])|([7][5])|([8][56]))[0-9]{8}$";
private static String regTelecomStr = "^1(([3][3])|([5][3])|([7][07])|([8][019]))[0-9]{8}$";

private CommonUtils() {
}


/**
 * return if str is empty
 *
 * @param str
 * @return
 */
public static boolean isEmpty(String str) {
    if (str == null || str.length() == 0 || str.equalsIgnoreCase("null") || str.isEmpty() || str.equals("")) {
        return true;
    } else {
        return false;
    }
}

/**
 * 驗證手機號是否合法
 *
 * @param mobile
 * @return
 */
public static boolean isMobileLawful(String mobile) {
    if (!isEmpty(mobile)) {
        /** */
        /** 第一步判斷中國移動 */
        if (mobile.matches(CommonUtils.regMobileStr)) {
            return true;
        }
        /** */
        /** 第二步判斷中國聯通 */
        if (mobile.matches(CommonUtils.regUnicomStr)) {
            return true;
        }
        /** */
        /** 第三步判斷中國電信 */
        if (mobile.matches(CommonUtils.regTelecomStr)) {
            return true;
        }
    }
    return false;
}

/**
 * 驗證json合法性
 *
 * @param jsonContent
 * @return
 */
public static boolean isJsonFormat(String jsonContent) {
    try {
        new JsonParser().parse(jsonContent);
        return true;
    } catch (JsonParseException e) {
        return false;
    }
}

/**
 * 格式化日期
 *
 * @param date
 * @return 年月日
 */
public static String formatDate(Date date) {
    return formatDate.format(date);
}

/**
 * 格式化日期
 *
 * @param date
 * @return 年月日 時分秒
 */
public static String formatDateTime(Date date) {
    return formatDateTime.format(date);
}

/**
 * 將時間戳解析成日期
 *
 * @param timeInMillis
 * @return 年月日
 */
public static String parseDate(long timeInMillis) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(timeInMillis);
    Date date = calendar.getTime();
    return formatDate(date);
}

/**
 * 將時間戳解析成日期
 *
 * @param timeInMillis
 * @return 年月日 時分秒
 */
public static String parseDateTime(long timeInMillis) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(timeInMillis);
    Date date = calendar.getTime();
    return formatDateTime(date);
}

/**
 * 解析日期
 *
 * @param date
 * @return
 */
public static Date parseDate(String date) {
    Date mDate = null;
    try {
        mDate = formatDate.parse(date);
    } catch (ParseException e) {
        e.printStackTrace();
    }

    return mDate;
}

/**
 * 解析日期
 *
 * @param datetime
 * @return
 */
public static Date parseDateTime(String datetime) {
    Date mDate = null;
    try {
        mDate = formatDateTime.parse(datetime);
    } catch (ParseException e) {
        e.printStackTrace();
    }

    return mDate;
}

/**
 * 對指定字符串進行md5加密
 *
 * @param s
 * @return 加密後的數據
 */
public static String EncryptMD5(String s) {
    char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
            'a', 'b', 'c', 'd', 'e', 'f'};
    try {
        byte[] btInput = s.getBytes();
        // 獲得MD5摘要算法的 MessageDigest 對象
        MessageDigest mdInst = MessageDigest.getInstance("MD5");
        // 使用指定的字節更新摘要
        mdInst.update(btInput);
        // 獲得密文
        byte[] md = mdInst.digest();
        // 把密文轉換成十六進制的字符串形式
        int j = md.length;
        char str[] = new char[j * 2];
        int k = 0;
        for (int i = 0; i < j; i++) {
            byte byte0 = md[i];
            str[k++] = hexDigits[byte0 >>> 4 & 0xf];
            str[k++] = hexDigits[byte0 & 0xf];
        }
        return new String(str);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

/**
 * 判斷email格式是否正確
 *
 * @param email
 * @return
 */
public static boolean isEmail(String email) {
    String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(email);
    return m.matches();
}

/**
 * 根據系統語言判斷是否爲中國
 *
 * @return
 */
public static boolean isZh() {
    Locale locale = BaseApp.getInstance().getResources().getConfiguration().locale;
    String language = locale.getLanguage();
    if (language.startsWith("zh")) {
        return true;
    } else {
        return false;
    }
}

/**
 * Try to return the absolute file path from the given Uri
 *
 * @param context
 * @param uri
 * @return the file path or null
 */
public static String getRealFilePath(final Context context, final Uri uri) {
    if (null == uri) return null;
    final String scheme = uri.getScheme();
    String data = null;
    if (scheme == null)
        data = uri.getPath();
    else if (ContentResolver.SCHEME_FILE.equals(scheme)) {
        data = uri.getPath();
    } else if (ContentResolver.SCHEME_CONTENT.equals(scheme)) {
        Cursor cursor = context.getContentResolver().query(uri, new String[]{MediaStore.Images.ImageColumns.DATA}, null, null, null);
        if (null != cursor) {
            if (cursor.moveToFirst()) {
                int index = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
                if (index > -1) {
                    data = cursor.getString(index);
                }
            }
            cursor.close();
        }
    }
    return data;
}

/**
 * 獲取gson對象
 *
 * @return
 */
public static Gson getGson() {
    if (mGson == null) {
        mGson = new GsonBuilder().setDateFormat(GSON_FORMAT).create(); // 創建gson對象,並設置日期格式
    }

    return mGson;
}

/**
 * 調用震動器
 *
 * @param context      調用該方法的Context
 * @param milliseconds 震動的時長,單位是毫秒
 */
public static void vibrate(final Context context, long milliseconds) {
    Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
    vib.vibrate(milliseconds);
}

/**
 * 調用震動器
 *
 * @param context  調用該方法的Context
 * @param pattern  自定義震動模式 。數組中數字的含義依次是[靜止時長,震動時長,靜止時長,震動時長。。。]時長的單位是毫秒
 * @param isRepeat 是否反覆震動,如果是true,反覆震動,如果是false,只震動一次
 */
public static void vibrate(final Context context, long[] pattern, boolean isRepeat) {
    Vibrator vib = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
    vib.vibrate(pattern, isRepeat ? 1 : -1);
}

/**
 * 播放音樂
 *
 * @param context
 */
public static void playMusic(Context context) {
    MediaPlayer mp = MediaPlayer.create(context, R.raw.beep);
    mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
    mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mediaPlayer) {
            mediaPlayer.start();
        }
    });
    mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mediaPlayer) {
            mediaPlayer.release();
        }
    });
}

/**
 * 獲取聯繫人電話
 *
 * @param cursor
 * @return
 */
private String getContactPhone(Context context, Cursor cursor) {

    int phoneColumn = cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER);
    int phoneNum = cursor.getInt(phoneColumn);
    String phoneResult = "";
    //System.out.print(phoneNum);
    if (phoneNum > 0) {
        // 獲得聯繫人的ID號
        int idColumn = cursor.getColumnIndex(ContactsContract.Contacts._ID);
        String contactId = cursor.getString(idColumn);
        // 獲得聯繫人的電話號碼的cursor;
        Cursor phones = context.getContentResolver().query(
                ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                null,
                ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId,
                null, null);
        //int phoneCount = phones.getCount();
        //allPhoneNum = new ArrayList<String>(phoneCount);
        if (phones.moveToFirst()) {
            // 遍歷所有的電話號碼
            for (; !phones.isAfterLast(); phones.moveToNext()) {
                int index = phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
                int typeindex = phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE);
                int phone_type = phones.getInt(typeindex);
                String phoneNumber = phones.getString(index);
                switch (phone_type) {
                    case 2:
                        phoneResult = phoneNumber;
                        break;
                }
                //allPhoneNum.add(phoneNumber);
            }
            if (!phones.isClosed()) {
                phones.close();
            }
        }
    }
    return phoneResult;
}

/**
 * 判斷email格式是否正確
 *
 * @param s
 * @return
 */
public static boolean digital(CharSequence s) {
    String str = "^[0-9]*$";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(s);
    return m.matches();
}

}
2.對於安卓用戶,單位換算經常遇到。挺雞肋的,還是總結一下吧。
public class DensityUtils {

private static final float DOT_FIVE = 0.5f;


/**
 * dip to px
 *
 * @param context
 * @param dip
 * @return
 */
public static int dip2px(Context context, float dip) {
    float density = getDensity(context);
    return (int) (dip * density + DensityUtils.DOT_FIVE);
}

/**
 * px to dip
 *
 * @param context
 * @param px
 * @return
 */
public static int px2dip(Context context, float px) {
    float density = getDensity(context);
    return (int) (px / density + DOT_FIVE);
}

private static DisplayMetrics sDisplayMetrics;

/**
 * get screen width
 *
 * @param context
 * @return
 */
public static int getDisplayWidth(Context context) {
    initDisplayMetrics(context);
    return sDisplayMetrics.widthPixels;
}

/**
 * get screen height
 *
 * @param context
 * @return
 */
public static int getDisplayHeight(Context context) {
    initDisplayMetrics(context);
    return sDisplayMetrics.heightPixels;
}

/**
 * get screen density
 *
 * @param context
 * @return
 */
public static float getDensity(Context context) {
    initDisplayMetrics(context);
    return sDisplayMetrics.density;
}


/**
 * get screen density dpi
 *
 * @param context
 * @return
 */
public static int getDensityDpi(Context context) {
    initDisplayMetrics(context);
    return sDisplayMetrics.densityDpi;
}

/**
 * init display metrics
 *
 * @param context
 */
private static synchronized void initDisplayMetrics(Context context) {
    sDisplayMetrics = context.getResources().getDisplayMetrics();
}

/**
 * is landscape
 *
 * @param context
 * @return
 */
public static boolean isLandscape(Context context) {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
}

/**
 * is portrait
 *
 * @param context
 * @return
 */
public static boolean isPortrait(Context context) {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
}

}
3.圓頭像這個遇見的太多了,必須分享下,直接使用(最好用android:src屬性)就行什麼都不用配置。
public class CircleImageView extends ImageView {

private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP;

private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888;
private static final int COLORDRAWABLE_DIMENSION = 2;

private static final int DEFAULT_BORDER_WIDTH = 0;
private static final int DEFAULT_BORDER_COLOR = Color.BLACK;

private final RectF mDrawableRect = new RectF();
private final RectF mBorderRect = new RectF();

private final Matrix mShaderMatrix = new Matrix();
private final Paint mBitmapPaint = new Paint();
private final Paint mBorderPaint = new Paint();

private int mBorderColor = DEFAULT_BORDER_COLOR;
private int mBorderWidth = DEFAULT_BORDER_WIDTH;

private Bitmap mBitmap;
private BitmapShader mBitmapShader;
private int mBitmapWidth;
private int mBitmapHeight;

private float mDrawableRadius;
private float mBorderRadius;

private ColorFilter mColorFilter;

private boolean mReady;
private boolean mSetupPending;

public CircleImageView(Context context) {
    super(context);

    init();
}

public CircleImageView(Context context, AttributeSet attrs) {
    this(context, attrs, 0);
}

public CircleImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0);

    mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_border_width, DEFAULT_BORDER_WIDTH);
    mBorderColor = a.getColor(R.styleable.CircleImageView_border_color, DEFAULT_BORDER_COLOR);

    a.recycle();

    init();
}

private void init() {
    super.setScaleType(SCALE_TYPE);
    mReady = true;

    if (mSetupPending) {
        setup();
        mSetupPending = false;
    }
}

@Override
public ScaleType getScaleType() {
    return SCALE_TYPE;
}

@Override
public void setScaleType(ScaleType scaleType) {
    if (scaleType != SCALE_TYPE) {
        throw new IllegalArgumentException(String.format("ScaleType %s not supported.", scaleType));
    }
}

@Override
public void setAdjustViewBounds(boolean adjustViewBounds) {
    if (adjustViewBounds) {
        throw new IllegalArgumentException("adjustViewBounds not supported.");
    }
}

@Override
protected void onDraw(Canvas canvas) {
    if (getDrawable() == null) {
        return;
    }

    canvas.drawCircle(getWidth() / 2, getHeight() / 2, mDrawableRadius, mBitmapPaint);
    if (mBorderWidth != 0) {
        canvas.drawCircle(getWidth() / 2, getHeight() / 2, mBorderRadius, mBorderPaint);
    }
}

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    setup();
}

public int getBorderColor() {
    return mBorderColor;
}

public void setBorderColor(int borderColor) {
    if (borderColor == mBorderColor) {
        return;
    }

    mBorderColor = borderColor;
    mBorderPaint.setColor(mBorderColor);
    invalidate();
}

public int getBorderWidth() {
    return mBorderWidth;
}

public void setBorderWidth(int borderWidth) {
    if (borderWidth == mBorderWidth) {
        return;
    }

    mBorderWidth = borderWidth;
    setup();
}

@Override
public void setImageBitmap(Bitmap bm) {
    super.setImageBitmap(bm);
    mBitmap = bm;
    setup();
}

@Override
public void setImageDrawable(Drawable drawable) {
    super.setImageDrawable(drawable);
    mBitmap = getBitmapFromDrawable(drawable);
    setup();
}

@Override
public void setImageResource(int resId) {
    super.setImageResource(resId);
    mBitmap = getBitmapFromDrawable(getDrawable());
    setup();
}

@Override
public void setImageURI(Uri uri) {
    super.setImageURI(uri);
    mBitmap = getBitmapFromDrawable(getDrawable());
    setup();
}

@Override
public void setColorFilter(ColorFilter cf) {
    if (cf == mColorFilter) {
        return;
    }

    mColorFilter = cf;
    mBitmapPaint.setColorFilter(mColorFilter);
    invalidate();
}

private Bitmap getBitmapFromDrawable(Drawable drawable) {
    if (drawable == null) {
        return null;
    }

    if (drawable instanceof BitmapDrawable) {
        return ((BitmapDrawable) drawable).getBitmap();
    }

    try {
        Bitmap bitmap;

        if (drawable instanceof ColorDrawable) {
            bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG);
        } else {
            bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG);
        }

        Canvas canvas = new Canvas(bitmap);
        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        drawable.draw(canvas);
        return bitmap;
    } catch (OutOfMemoryError e) {
        return null;
    }
}

private void setup() {
    if (!mReady) {
        mSetupPending = true;
        return;
    }

    if (mBitmap == null) {
        return;
    }

    mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);

    mBitmapPaint.setAntiAlias(true);
    mBitmapPaint.setShader(mBitmapShader);

    mBorderPaint.setStyle(Paint.Style.STROKE);
    mBorderPaint.setAntiAlias(true);
    mBorderPaint.setColor(mBorderColor);
    mBorderPaint.setStrokeWidth(mBorderWidth);

    mBitmapHeight = mBitmap.getHeight();
    mBitmapWidth = mBitmap.getWidth();

    mBorderRect.set(0, 0, getWidth(), getHeight());
    mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2);

    mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
    mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2);

    updateShaderMatrix();
    invalidate();
}

private void updateShaderMatrix() {
    float scale;
    float dx = 0;
    float dy = 0;

    mShaderMatrix.set(null);

    if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) {
        scale = mDrawableRect.height() / (float) mBitmapHeight;
        dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f;
    } else {
        scale = mDrawableRect.width() / (float) mBitmapWidth;
        dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f;
    }

    mShaderMatrix.setScale(scale, scale);
    mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth, (int) (dy + 0.5f) + mBorderWidth);

    mBitmapShader.setLocalMatrix(mShaderMatrix);
}

}
別忘了在attrs中添加自定義屬性:


    <attr name="border_width" format="dimension" />
    <attr name="border_color" format="color" />

</declare-styleable>

4.這個大家都知道,日期轉換。但是“23十月2015”這種格式的是不是很少見。
/*****************************************************************************************
* function: 日期工具類:將util.Date日期轉換成大寫日期格式
* @project web
* @package base.datetime
* @fileName DateUtils.java
*/

import java.util.Calendar;
import java.util.Date;

public class DateUtils {
// 日期轉化爲大小寫
public static String dataToUpper(Date date) {
Calendar ca = Calendar.getInstance();
ca.setTime(date);
int year = ca.get(Calendar.YEAR);
int month = ca.get(Calendar.MONTH) + 1;
int day = ca.get(Calendar.DAY_OF_MONTH);
return day+” “+monthToUppder(month) + “月” +” “+year;
}

/***
 * <b>function:</b> 將數字轉化爲大寫
 * @param num 數字
 * @return 轉換後的大寫數字
 */
public static String numToUpper(int num) {
    // String u[] = {"零","壹","貳","叄","肆","伍","陸","柒","捌","玖"};
    String u[] = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"};
    //String u[] = {"○", "一", "二", "三", "四", "五", "六", "七", "八", "九"};
    char[] str = String.valueOf(num).toCharArray();
    String rstr = "";
    for (int i = 0; i < str.length; i++) {
        rstr = rstr + u[Integer.parseInt(str[i] + "")];
    }
    return rstr;
}

/***
 * <b>function:</b> 月轉化爲大寫
 * @param month 月份
 * @return 返回轉換後大寫月份
 */
public static String monthToUppder(int month) {
    if (month < 10) {
        return numToUpper(month);
    } else if (month == 10) {
        return "十";
    } else {
        return "十" + numToUpper(month - 10);
    }
}

/***
 * <b>function:</b> 日轉化爲大寫
 * @param day 日期
 * @return 轉換大寫的日期格式
 */
public static String dayToUppder(int day) {
    if (day < 20) {
        return monthToUppder(day);
    } else {
        char[] str = String.valueOf(day).toCharArray();
        if (str[1] == '0') {
            return numToUpper(Integer.parseInt(str[0] + "")) + "十";
        } else {
            return numToUpper(Integer.parseInt(str[0] + "")) + "十" + numToUpper(Integer.parseInt(str[1] + ""));
        }
    }
}

public static void main(String[] args) {

    System.out.println(DateUtils.dataToUpper(new Date()));
}

}
5.保存圖片到本地(之前的博客也寫過。不過據說這種方法不能適配所有安卓機型,但是目前爲止我還沒有遇見不適配的所以一直在用)
public class SaveImage {
/**
* 保存文件
* @param bm
* @param fileName
* @throws IOException
*/
public static void saveFile(Bitmap bm, String fileName) throws IOException {
String path = getSDPath() +”/fashion/”;
File dirFile = new File(path);
if(!dirFile.exists()){
dirFile.mkdir();
}
File myCaptureFile = new File(path + fileName);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 60, bos);
bos.flush();
bos.close();
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri uri = Uri.fromFile(dirFile);
intent.setData(uri);
APP.getInstance().sendBroadcast(intent);
}
public static String getSDPath(){
File sdDir = null;
boolean sdCardExist = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED); //判斷sd卡是否存在
if (sdCardExist)
{
sdDir = Environment.getExternalStorageDirectory();//獲取跟目錄
}
return sdDir.toString();
}
/**
* return a bitmap from service
* @param url
* @return bitmap type
*/
public final static Bitmap returnBitMap(String url) {
URL myFileUrl = null;
Bitmap bitmap = null;

    try {
        myFileUrl = new URL(url);
        HttpURLConnection conn;

        conn = (HttpURLConnection) myFileUrl.openConnection();

        conn.setDoInput(true);
        conn.connect();
        InputStream is = conn.getInputStream();
        bitmap = BitmapFactory.decodeStream(is);

    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }  catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return bitmap;
}

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章