android-studio

long SVG Asset file error : R is not a valid verb. Failure occurred at position 2 of path: STRING_TOO_LARGE

耗尽温柔 提交于 2021-02-09 09:36:57
问题 I'm having some problems with Android Studio at the moment because I recently started using "Vector Assets". I've done absolutely everything necessary to display them correctly in my application (using the app:srcCompat="" in the xml, android {defaultConfig {vectorDrawables.useSupportLibrary true}} in the build.gradle, and AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); in the onCreate() method before setContentView() ). The svg files I imported into Android Studio do not have

Kotlin “also” function strange warning in Android Studio

十年热恋 提交于 2021-02-08 15:43:13
问题 There is two presumably identical snippets: // Verbose version val typedArray = context.obtainStyledAttributes(attrs, styleable) block(typedArray) typedArray.recycle() // One-line version context.obtainStyledAttributes(attrs, styleable).also(block).recycle() I'm wonder why verbose block of code looks fine to Android Studio, whereas one-line version highlights obtainStyledAttributes and gives following warning: This TypedArray should be recycled after use with #recycle() Does anyone know is it

How can I use Pixel 4 (Or any Android device that supports Face ID) in Android Studio emulator

◇◆丶佛笑我妖孽 提交于 2021-02-08 13:27:50
问题 I'm using Android Studio 3.6.2 and have Android R preview installed. Running Android Emulator 30.0.5. When I try to create a virtual device (From AVD) Pixel 4 is not listed. I have followed the instructions on setting up a new emulator and have read this reddit post which links to this issue tracker. Someone posted that it might land late this year. But I have an immediate need to test Face ID. Is it possible to use the Pixel 4 in the Android Emulator? 回答1: I don't think it's listed. You'll

Android ImageView not loaded

孤人 提交于 2021-02-08 13:01:10
问题 I am using the android imageView and I put the the image into the drawable folder, and changed the imageView source to that image. But it does not show the image in the Preview panel and when I open the picture in the android studio,it show the error like this. But I can open the picture on my computer desktop. so why there is the error and how to solve it? 回答1: Sounds like piac.png was not a .png file, you just slapped a .png extension on it and expected it to become a .png file. The problem

Reading a gatt characteristic value in android studio notification

冷暖自知 提交于 2021-02-08 11:41:34
问题 I want to read a GATT characteristic value by the way of notification. This means I need to set that characteristic to notify and then read the data. I wish to do this in a function from an onclick. When I run my activity the characteristics are found and added to this arraylist private ArrayList<ArrayList<BluetoothGattCharacteristic>> mGattCharacteristics = new ArrayList<ArrayList<BluetoothGattCharacteristic>>(); I have the UUIDs of the service and characteristic values how do I get a

how to get data usage from settings in android

﹥>﹥吖頭↗ 提交于 2021-02-08 11:31:26
问题 I'm trying to get 3g and wifi usage from Settings page in android, is there anyway to do that, i can set an intent Settings data usage page, code is below; Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.settings","com.android.settings.Settings$DataUsageSummaryActivity")); startActivity(intent); But is there any way to reach these intent's component and to get data from those components. Thankss.. 回答1: Yes you can programmatically get the data usage // Get

How to delete data in ListView and also from Firebase?

徘徊边缘 提交于 2021-02-08 11:29:18
问题 I am working on an Android Application that saves the medicine Inventory in Firebase. All Inventory saved on Firebase perfectly. The Links i have visited are this this I showed all inventory in the list in the Android. Now What I want to do is delete the data item from the list by having a button again every list Item. Here is my XML code of list view <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http:

How to get plain text from NFC Tag?

白昼怎懂夜的黑 提交于 2021-02-08 11:24:44
问题 I have tried to implement the code from Google documentation but it is still not clear for me. What am I missing here? This is method in MainActivity.java: @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) { Parcelable[] rawMessages = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (rawMessages != null) { NdefMessage[] messages = new NdefMessage[rawMessages.length]; for (int i =

Minimum Necessary files for an android build

强颜欢笑 提交于 2021-02-08 11:15:27
问题 Trying to find the bare minimum source and build files needed to build an android project in Android Studio. I want to publish to github and avoid uploading generated build files or binaries. I do have a Android.gitignore from but I still see some more files getting pushed into the repo which may not be necessary. I understand the few obvious ones but about others, do I need them and if so kindly explain the usage. So the question, do I need the following and if so then a short description of

How to link html files in WebView?

时光毁灭记忆、已成空白 提交于 2021-02-08 10:24:40
问题 I have a huge folder of htm files and a single html file with a href links to each of these htm files. I would like to create an android app, for personal use, to make browsing these files easier on a tablet. I managed to load the main html file to WebView in Android Studio, but clicking any URL results in a crash, therefore I can't load any htm file through my html catalog. I am not experienced in android programming, I only have some out-of-date experience in website creation back from the