0

I am creating an app in android studio using java , I want to create a theme appearance setting like YouTube where user have 3 options to select one of them... 1) Use device theme 2) Dark theme 3) Light theme. But I don't know how to implement it in java activity and xml activity, can anyone help me ?

here I am attaching screenshot of what I want. enter image description here

Asad
  • 1
  • 2

2 Answers2

0

Here's a comprehensive description of how you might achieve that using XML layouts and styles: https://developer.android.com/guide/topics/ui/look-and-feel/darktheme

If you're completely new to XML theming in Android, then watch this video first: https://www.youtube.com/watch?v=Owkf8DhAOSo

A. Patrik
  • 1,530
  • 9
  • 20
0

It is calls Dialog with radiobuttons. All about it + implementation example - https://suragch.medium.com/adding-a-list-to-an-android-alertdialog-e13c1df6cf00

Yegorf
  • 400
  • 2
  • 11
  • thanks for answering . now i am able to implement it in xml , but i also want to know how i switch dark theme, light theme, and device theme in java code . for example when i click on dark theme radiobutton my app should change into dark theme,when i select device theme option then app theme will be the same as device theme. – Asad Apr 10 '21 at 10:19
  • https://stackoverflow.com/questions/2482848/how-to-change-current-theme-at-runtime-in-android – Yegorf Apr 10 '21 at 11:04