I am writing a unit test to check the email validation logic. The logic is throwing null pointer exception when you run the test. But it works fine with emulator. Can someone help me solving this? Below is my unit test. The error I am getting is, Answer android.util.Patterns.EMAIL_ADDRESS.matcher(email).match…
Tag: android
How to exclude all files under a directory in Gradle?
For example, this one will exclude 1 file. But how to exclude all file under a directory? like: org/apache/commons/codec/language/bm/ folder? . does not work 🙂 Answer wild card can be used to enforce action to multiple file in directory. See this:- You can also exclude a file/directory with out specifying the…
Error:Execution failed for task ‘:app:mergeDebugResources’. > Some file crunching failed, see logs for details build gradle issues
currently I am using Android Studio 2.1 when I run my App it shows me some error in Message Gradle Build saying the following I tried cleaning and rebuilding it but it didn’t work. The answer for this question didn’t work also. Any help would be appreciated, thanks. Updated: Here is the log output…
Android Data Binding pass arguments to onClick method
Is it possible to pass custom arguments to onClick method using the Data Binding Library? I have my layout xml file where I need to use the onClickListener: and I a have my click handler code here: Is it possible to pass my CategoryViewModel object from xml to click handler? Answer You can use a lambda expres…
File structure listing as Json
How can I get a local directory listing as a Json? So If I provide a folder, I want to see all its subfolders and files in a json tree type object. Please note: I don’t want just the list with file paths. Thank you! Answer So @CommonsWare put me in the right direction and I was able to do
Cannot resolve method ‘findViewByID(int)’ in Android Studio
I only just started coding for androud, but I’ve been getting the error: “Cannot resolve method ‘findViewByID(int)’” in android studio I can’t seem to find out what is wrong, have tried setting contentView, implementing OnClickListenener, but none of these fixed anything. full co…
javax.net.ssl.SSLException: Connection closed by peer on 4.4.2 device (works on 6.0.1)
I have a problem with getting this error when I’m performing network calls inside my app. Main problem is that same code works on Android 6.0.1 device, but on 4.4.2 device, I’m getting this error: where I’m unable to request data from server. If you need more data, feel free to ask. Thanks. …
ListFragment Not displaying data from List
After I try to open the navigation drawer and go to a different tab and then go back to it. It is not showing data in a list once again. Main Activity UniverseListing Glimpse List Fragment Answer You create an Activity instance that isn’t managed by the Android life cycle, so the Arraylist that you want…
Buetooth connection failed: read failed, socket might closed or timeout, read ret: -1
I am trying to create a Bluetooth connection. I can search for nearby devices but when I try to connect I get an error I do not understand: LOGCAT I Have two classes for connect, one that receives the device and execute the connection, an other for make connection. ConexionActivity.Java ConnectThread.java Imp…
How do I read Google Sheet content via Android’s Drive API?
I’m currently working on an app where the user can pick a Google Sheet file (.xlxs) from their Google Drive. My app will then extract and work with certain content of that Sheet. I’m using the Google Drive API made for Android and I utilize the example classes from Google Drive Android Demos So fa…