導航:首頁 > 操作系統 > 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鎖屏界面開發相關的資料

熱點內容
項目編譯後瀏覽器不對應刷新 瀏覽:564
三星升級android60 瀏覽:292
粘土的壓縮模量 瀏覽:115
美國程序員生活 瀏覽:219
51單片機摘要 瀏覽:405
英語經典pdf下載 瀏覽:317
大學文件夾怎麼刪除 瀏覽:668
linux科研軟體 瀏覽:553
ue4打包編譯著色器 瀏覽:775
雲伺服器可以在手機上登錄嗎 瀏覽:676
網游腳本為什麼要連接伺服器 瀏覽:7
程序員發展路線圖 瀏覽:320
手機語音加密會議 瀏覽:592
冰與火pdf 瀏覽:421
為什麼叫我買阿里雲伺服器 瀏覽:475
加密貨幣征稅一覽表 瀏覽:964
llc編譯器 瀏覽:927
數控可編程電阻器 瀏覽:762
培訓app源碼 瀏覽:436
phpcurl啟用 瀏覽:538