導航:首頁 > 操作系統 > android鎖屏界面開發

android鎖屏界面開發

發布時間:2025-08-03 01:53:11

① 求助==怎麼在android 鎖屏界面實現音樂頻譜圖

Visualizer 類,這個類只在Android 2.3以上的API才支持。
首先實例化Visualizer,參數SessionId可以通過MediaPlayer的對象獲得

[java] view plain
visualizer = new Visualizer(mPlayerInstance.getAudioSessionId());
接著設置需要轉換的音樂內容長度,專業的說這就是采樣,該采樣值一般為2的指數倍,如64,128,256,512,1024。這里我設置了128,原因是長度越長,FFT演算法運行時間更長。

[java] view plain

② Android開發設置鎖屏壁紙

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
File file = new File("mnt/sdcard2/DCIM/Camera/IMG_20120216_160054.jpg");
Intent intent = createSetAsIntent(Uri.fromFile(file),null);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(intent, "設置壁紙"));
// file:///mnt/sdcard2/DCIM/Camera/IMG_20120216_160054.jpg
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

public static Intent createSetAsIntent(Uri uri, String mimeType) {
// Infer MIME type if missing for file URLs.
if (uri.getScheme().equals("file")) {
String path = uri.getPath();
int lastDotIndex = path.lastIndexOf('.');
if (lastDotIndex != -1) {
mimeType = MimeTypeMap.getSingleton()
.getMimeTypeFromExtension(
uri.getPath().substring(lastDotIndex + 1)
.toLowerCase());
}
}

Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
intent.setDataAndType(uri, mimeType);
intent.putExtra("mimeType", mimeType);
return intent;
}

閱讀全文

與android鎖屏界面開發相關的資料

熱點內容
linux運維常用命令 瀏覽:554
深圳模型編程師月工資多少 瀏覽:685
阿里雲聚石塔的伺服器公司名 瀏覽:464
php中怎麼寫html 瀏覽:692
火車上有趣的命令 瀏覽:448
華為暢連app是什麼用的 瀏覽:22
壓縮pdf加密文件解壓 瀏覽:340
有關計算機編程的問題 瀏覽:891
家裝裝修報價演算法 瀏覽:910
編譯器常用優化方法 瀏覽:896
燕窩正規進口一定要溯源碼燕窩嗎 瀏覽:608
五子棋游戲編程 瀏覽:60
唱吧導入歌曲在哪個文件夾 瀏覽:139
為什麼京東的伺服器這么牛 瀏覽:849
項目編譯失敗日誌在哪裡看 瀏覽:766
壓縮文件為ara格式 瀏覽:110
程序員腱鞘炎 瀏覽:448
linuxi915 瀏覽:711
球球英雄三星安卓怎麼切換 瀏覽:355
軟天空為什麼會伺服器數據異常 瀏覽:529