I am having problems testing my app. I created an espresso test which is supposed to fail, since whenever I launch my app in the emulator, I get the expected behavior. There is my test: When launching the test, nothing is reported, whereas nextQuestionButton should not be enabled upon clicking the radioButton…
Tag: android-studio
How to get to the end of a line in android studio
Is there a way to get the cursor to the end of the current line? That is, without using the End key, Ctrl + Left/Right or the mouse. It’s time consuming to get to the end of the line when there’s some code after the cursor. eg. In a strings.xml file, the end tag is automatically generated and afte…
Why JAR Files Do Not Contain Documentation?
I’m in the process of writing a small Java library that contains a related code that I usually include in most of my android app. I decided to export the library as a jar file then drop the file in the libs folder of my future projects. Using Android Studio: I created a Java Library module and put my co…
TextView cannot be cast to EditText
First time posting a question to this site so I might make some mistakes! I’m new to programming and getting the following error when running an application in Android Studio: The code that’s causing this issue is I’ve tried to delete the R.java files and clean the project but it didn’…
Why doesn’t Android Studio recognize Base64.encodeBase64?
I’m trying run the following code, however I cannot use encodeBase64(). I’ve already tried to import such libraries using Alt + Enter. How can I make it work? Answer use this: instead of what you are using, i also advise you to use: .getBytes(“UTF-8”); instead of data.getBytes(); UTF-8…
Error: This fragment should provide a default constructor (a public constructor with no arguments)
My class extends DialogFragment like this: And this is how i am using it in Activity: And calling like this: But I am always getting : Answer The newer version of Android SDK forces you to get a empty, no-args constructor. It’s now a good practice to do this. This allows you to save the instance state i…
Android Programmatically open Settings-> Security tab on Button Click
How can I open Android > Settings > Security tab from within my app? In my app, I have one simple button and I want to open the Security tab setting on button click listener event. I have tried to open android settings, but how do I open specifically the security one? Answer Try this instead:
Cannot import ksoap2 to Android Studio
I just added ksoap2 (actually it is ksoap2-android-assembly-3.4.0-jar-with-dependencies.jar) to app/libs folder. Also I have used the Project Structure window to add ksoap2 to the Dependencies tab. the Build.Gradle has this section Anyway I cannot import ksoap2 like Any clue? Answer At first, You should remov…
Android Studio: create Java project with no Android dependencies
It’s possible to add pure Java module to existing Android project. But is it possible to create pure Java project with no Android dependencies? Answer Yes, it is possible. You have to manually create all necessary files. Here are steps for Gradle based project: Remove include ‘:app’ form set…
JetBrains IntelliJ Error launching Intellij Platform – Error invoking main method
I have IntelliJ IDEA and other JetBrains products installed and they worked great (PyCharm, Android Studio, Clion, WebStorm) till today, now I just get opening message: Error launching Intellij Platform – Error invoking main method I have installed: C:Program FilesJavajdk1.8.0_25 C:Program FilesJavajre1…