創作

2016年1月5日 星期二

ADB 指令

adb root  //ROOT裝置,ROOT完後記得重新插拔
adb remount //重設權限
adb shell //進入裝置,可以下裝置指令


//------------------裝置內---------------------
getprop | grep lcd    //取得裝置DPI
mount -o remount,rw /  //取消唯讀權限

2015年10月15日 星期四

Android MediaPlayer注意事項

1.如果有用到SurfaceView,必須在mediaPlayer.prepare之前,mediaPlayer.setDisplay(surfaceHolder),
  否則在檔案大的影片,容易產生影音分離的問題。
  EX:
  player.setDataSource(filepath);
  player.setDisplay(surfaceHolder);
  player.prepare();



Error索引:可參照網址
    MEDIA_PLAYER_STATE_ERROR        = 0,
    MEDIA_PLAYER_IDLE                           = 1 << 0,     // 1
    MEDIA_PLAYER_INITIALIZED             = 1 << 1,    // 2
    MEDIA_PLAYER_PREPARING              = 1 << 2,    // 4
    MEDIA_PLAYER_PREPARED                = 1 << 3,    // 8
    MEDIA_PLAYER_STARTED                   = 1 << 4,   // 16
    MEDIA_PLAYER_PAUSED                     = 1 << 5,   // 32
    MEDIA_PLAYER_STOPPED                    = 1 << 6,  // 64
    MEDIA_PLAYER_PLAYBACK_COMPLETE  = 1 << 7

2015年9月1日 星期二

Android Activity 切換

Android 切換Activity 方式如下:

Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);

Intent 狀態內容:
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT :如果Activity已創建,則移到最前 ,不會重複創建。
Intent.FLAG_ACTIVITY_CLEAR_TOP :跳到指定Activity,並移除最前端Activity。