我試圖重定向到設置壁紙時,用戶按下按鈕,但我閱讀文檔,並沒有發現類似的東西。有人能幫助我嗎?重定向到Android設置
我嘗試用
Intent i = new Intent(this, android.provider.Settings.ACTION_SETTINGS.getClass());
startActivity(i);
參考:Redirecting to device settings
但是,沒有工作
我試圖重定向到設置壁紙時,用戶按下按鈕,但我閱讀文檔,並沒有發現類似的東西。有人能幫助我嗎?重定向到Android設置
我嘗試用
Intent i = new Intent(this, android.provider.Settings.ACTION_SETTINGS.getClass());
startActivity(i);
參考:Redirecting to device settings
但是,沒有工作
試試這個:
Intent wallpaperChooser = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(wallpaperChooser);
工作!謝謝 – MrMins
試試這個
Intent i = new Intent(android.provider.Settings.ACTION_SETTINGS);
startActivity(i);
當你嘗試時會發生什麼? logcat輸出中是否有錯誤? –
這是日誌@EdwardFalk FATAL EXCEPTION:main java.lang.RuntimeException:無法啓動活動ComponentInfo {com.ss.wpaper/com.ss.wpaper.MainActivity}:android.content.ActivityNotFoundException:無法找到顯式活動類{com.ss.wpaper/java.lang.String中};你有沒有在你的AndroidManifest.xml中聲明這個活動?引起:android.content.ActivityNotFoundException:無法找到顯式活動類{com.ss.wpaper/java.lang.String};你有沒有在你的AndroidManifest.xml中聲明這個活動? - – MrMins
Intent i = new Intent(this,android.provider.Settings.ACTION_SETTINGS.getClass())它將打開屬於您的應用程序的活動。所以有ActivityNotFoundException引發 –