android-studio

Android Studio Preview Not Showing RecyclerView and Toolbar Correctly

孤者浪人 提交于 2020-03-25 22:35:20
问题 Please find the screenshots I searched lot for this. My android studio is updated with 3.0.1. Here are the dependencies in my project. Is the issue with studio 3.0.1? compile 'com.android.support:appcompat-v7:23.4.+' compile 'com.android.support:design:23.3.0'` Here is the xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">

Android/Sdk is missing a Tools folder, meaing no sdkmanager, meaning “Android license status unknown” error

╄→尐↘猪︶ㄣ 提交于 2020-03-25 18:56:06
问题 I wanted to start learning Flutter, so I'm following the guide, but I'm already stuck on the very first step. I haven't done anything other than create a brand new app, but when I hit "Run" in Android Studio I get the following error: FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. > Failed to install the following Android SDK packages as some licences have not been accepted. build-tools;28.0.3 Android

Do I need to change my xml code for supporting all screen size android devices?

本秂侑毒 提交于 2020-03-25 18:49:16
问题 I have created layout for different screen size and this is my xml code for default layout but so any one please tell me what I should do to support my layout for any screen size android devices. do I need to change my xml code? or just I need to modify my xml code ? please tell me so I can solve my problem xlm <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"

Set gradient color for text in Android Studio with Kotlin language

烂漫一生 提交于 2020-03-25 18:47:28
问题 I have a text and I want to set a gradient color as its foreground. May I do it in xml? Or should I do it in activity? I am programming with Kotlin in Android Studio. activity_main.xml <androidx.constraintlayout.widget.ConstraintLayout xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:layout

App crashes while changing the orientation from landscape to portrait

断了今生、忘了曾经 提交于 2020-03-25 18:38:40
问题 ERROR **2020-03-01 17:36:58.959 6589-6589/com.studenthelper.bscit E/AndroidRuntime: FATAL EXCEPTION: main Process: com.studenthelper.bscit, PID: 6589 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.studenthelper.bscit/com.studenthelper.bscit.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference at android.app.ActivityThread.performLaunchActivity

App crashes while changing the orientation from landscape to portrait

牧云@^-^@ 提交于 2020-03-25 18:37:08
问题 ERROR **2020-03-01 17:36:58.959 6589-6589/com.studenthelper.bscit E/AndroidRuntime: FATAL EXCEPTION: main Process: com.studenthelper.bscit, PID: 6589 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.studenthelper.bscit/com.studenthelper.bscit.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference at android.app.ActivityThread.performLaunchActivity

Problem with Grade sync in Android Studio

江枫思渺然 提交于 2020-03-23 12:11:31
问题 When I try to synch grade I got the following message: 1:09 PM Gradle sync failed: Could not find com.android.tools.build:gradle:3.6.1. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.jar - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom - https://repo.maven.apache.org/maven2

Adding views programmatically to LinearLayout but they don't appear

爷,独闯天下 提交于 2020-03-23 07:50:32
问题 I'm trying to populate a LinearLayout inside simple_pdf_example.xml with 10 printed_order_element2.xml just so I can generate a PDF with a ListView (which is actually a LinearLayout ). The problem is that when I do linearLayoutView.addView(v) 10 times, I don't see v inside the LinearLayout . I just see the original item I added in the xml just to see if the LinearLayout was rendering. SimplePDFSaver.java: package com.mypackage.example; import androidx.appcompat.app.AppCompatActivity; import

Gradle Sync failed: Premature end of Content-length delimited message body (Expected: 27633912;received : 12844960)

懵懂的女人 提交于 2020-03-22 09:29:41
问题 I have installed Android Studio 3.1.4 and the Gradle (Version 4.4) is not synchronizing; it says: Gradle Sync failed: Premature end of Content-length delimited message body (Expected: 27633912;received : 12844960) Build.Gradle 回答1: This was happening because of "unstable" internet connection. I used a stable connection and gradle synchronized successfully. 来源: https://stackoverflow.com/questions/51980686/gradle-sync-failed-premature-end-of-content-length-delimited-message-body-expe

Shared Preferences Android Studio

笑着哭i 提交于 2020-03-22 09:14:28
问题 For the code below I am trying to retrieve the shared preference, I think it saved correctly but when I go back to the login screen all the data is gone. I need it to remain when I go back to this screen. So i enter name, age and id into three separate lines on the profile page. Then i press the save button Then go to the page before by pressing back on the action bar. And when i go back to the profile page my info should still be there but its not Any help? package com.example.myprofile;