android-studio

How to make dark mode in every activity

﹥>﹥吖頭↗ 提交于 2020-12-15 07:13:23
问题 When I click night mode button it only apply in settings activity but other activities are not night mode. This is xml <Switch android:id="@+id/switch_button" android:layout_marginStart="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/night"/> This is SettingsActivity Switch aSwitch = findViewById(R.id.switch_button); aSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> { if (isChecked) { getDelegate().setLocalNightMode

Andriod Gradle issue

五迷三道 提交于 2020-12-15 07:06:53
问题 I imported an application in Andriod studio(the newest andriod studio version), and I tried everything like: uninstall and install the JDK again, re-apply for each library, updating the SDK manager, the code is before 5-6 years ago, so now im trying to update the Gradle and I couldn't fix this issue. build.gradle(modules:app) apply plugin: 'com.android.application' android { compileSdkVersion 16 buildToolsVersion "29.0.2" defaultConfig { applicationId "com.App" minSdkVersion 11

Andriod Gradle issue

僤鯓⒐⒋嵵緔 提交于 2020-12-15 07:03:09
问题 I imported an application in Andriod studio(the newest andriod studio version), and I tried everything like: uninstall and install the JDK again, re-apply for each library, updating the SDK manager, the code is before 5-6 years ago, so now im trying to update the Gradle and I couldn't fix this issue. build.gradle(modules:app) apply plugin: 'com.android.application' android { compileSdkVersion 16 buildToolsVersion "29.0.2" defaultConfig { applicationId "com.App" minSdkVersion 11

Use onNewIntent(…) in a fragment

走远了吗. 提交于 2020-12-15 06:48:09
问题 I have a problem. I want to use a the method onNewIntent(...) and getIntent(...) . Unfortunately the fragment do not know this intent. How can I use this method in my fragment? This fragment should be able to read an NFC tag, so I need the intent. I would be very happy to receive an answer. I thank you in advance. Below you can see my code. public class UserFragmentGeldaufladen extends Fragment { private Dialog epicDialog; private NfcAdapter nfcAdapter; private PendingIntent pendingIntent;

Use onNewIntent(…) in a fragment

故事扮演 提交于 2020-12-15 06:47:12
问题 I have a problem. I want to use a the method onNewIntent(...) and getIntent(...) . Unfortunately the fragment do not know this intent. How can I use this method in my fragment? This fragment should be able to read an NFC tag, so I need the intent. I would be very happy to receive an answer. I thank you in advance. Below you can see my code. public class UserFragmentGeldaufladen extends Fragment { private Dialog epicDialog; private NfcAdapter nfcAdapter; private PendingIntent pendingIntent;

Emulator: failed to initialize WHPX: Function not implemented

偶尔善良 提交于 2020-12-15 06:27:31
问题 While trying to run the emulator on the android studio I am getting the following error Emulator: Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release. Emulator: failed to initialize WHPX: Function not implemented Emulator: Warning: requested RAM 1536M too high for your system. Reducing to maximum supported size 512M Emulator: qemu-system-x86_64.exe: Could not load library WinHvPlatform.dll.

Emulator: failed to initialize WHPX: Function not implemented

痞子三分冷 提交于 2020-12-15 06:27:23
问题 While trying to run the emulator on the android studio I am getting the following error Emulator: Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release. Emulator: failed to initialize WHPX: Function not implemented Emulator: Warning: requested RAM 1536M too high for your system. Reducing to maximum supported size 512M Emulator: qemu-system-x86_64.exe: Could not load library WinHvPlatform.dll.

Cannot close a custom AlertDialog

依然范特西╮ 提交于 2020-12-15 06:26:47
问题 so I have an app with three different buttons(parent buttons) on pressing any of them, the custom alert dialog with 9 different buttons is displayed but the functions of these 9 buttons within the alert dialog are different depending on which of the three parent buttons called it. On pressing any of the 9 buttons, I want the app to perform a particular function and then close the alertdialog. Now the problem is that I can easily call the alert dialog by calling the method showcustomdialog();

Cannot close a custom AlertDialog

戏子无情 提交于 2020-12-15 06:25:06
问题 so I have an app with three different buttons(parent buttons) on pressing any of them, the custom alert dialog with 9 different buttons is displayed but the functions of these 9 buttons within the alert dialog are different depending on which of the three parent buttons called it. On pressing any of the 9 buttons, I want the app to perform a particular function and then close the alertdialog. Now the problem is that I can easily call the alert dialog by calling the method showcustomdialog();

Where to lookup for the meaning “adb screencap” command's exit codes or how to get the meaning programatically?

こ雲淡風輕ζ 提交于 2020-12-15 06:17:26
问题 Process p = Runtime.getRuntime().exec("screencap -p /storage/sdcard0/test3332.png"); p.waitFor(); String error = "error: " + p.exitValue(); p.exitValue() is equal to 11 How to get the "meaning" or message from this exit code? If this should be available in the command's manual, then where to find this manual? Can someone post a link or a reference ? 回答1: The error message can be retrieved in this way: int ch; StringBuilder sb = new StringBuilder(); while((ch = p.getErrorStream().read()) != -1