To showing/hiding the password dots in the EditText in android, here’s the easy one-line way. #carbonads { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif; } #carbonads { display: block; overflow: hidden; max-width: 728px; position: relative; background-color: hsl(0, 0%, 99%); border: solid 1px #eee; font-size: 22px; box-sizing: content-box; } #carbonads span { display: block; } #carbonads a { color: inherit; text-decoration: none; } #carbonads a:hover { color: inherit; } .

Continue reading

In my current project at work, I had to setup a private maven repository hosted at Artifactory. I was assigned login credentials to access the libraries (or artifacts) from the repository. But, when I was fetching it from Android Studio project through build.gradle file, I was getting this exception on syncing the project. org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'MY_MAVEN_ARTIFACT_URL_GOES_HERE'. Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.

Continue reading

Encrypt Strings Please copy the AESUtils class in your project first and then you can use it like this. String encrypted = ""; String sourceStr = "This is any source string"; try { encrypted = AESUtils.encrypt(sourceStr); Log.d("TEST", "encrypted:" + encrypted); } catch (Exception e) { e.printStackTrace(); } #carbonads { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif; } #carbonads { display: block; overflow: hidden; max-width: 728px; position: relative; background-color: hsl(0, 0%, 99%); border: solid 1px #eee; font-size: 22px; box-sizing: content-box; } #carbonads span { display: block; } #carbonads a { color: inherit; text-decoration: none; } #carbonads a:hover { color: inherit; } .

Continue reading

In the recent Google IO 2018 event held in May 2018, Google recommended developers to update to latest Android APIs after August 1, 2018. So, this article is a big big reminder for this announcement. > # August 1 has passed and all the new android apps on Google Play should target API Level 26 (Android Oreo) in order to be published. But Why? Why should I update it? Well simple answer is: boss’s orders.

Continue reading

Kotlin supports a technique called conventions, everyone should be familiar with. For example, if you define a special method plus in your class, you can use the + operator by convention: That’s called Kotlin Operator Overloading. In this article, I want to show you which conventions you can use and I will also provide a few Kotlin code examples that demonstrate the concepts. Kotlin defines conventions that we can apply by implementing methods that comply with predefined names like plus.

Continue reading

When we use Fragment in our app, we often time need access to Context or Activity. We do it by calling methods such as getContext() and getActivity() methods. But, in kotlin, these methods return nullables and we end up using code like this. fun myTempMethod() { context?.let { // Do something here regarding context } // Or we do it like this var myNonNullActivity = activity!! } #carbonads { font-family: -apple-system, BlinkMacSystemFont, "

Continue reading

At my current project at work, I have a situation to add a third-party library locally instead of fetching it from jCenter or JitPack.io. So, my first task is to download AAR or JAR file of the library. The reason of using AAR/JAR is to avoid compiling of library on each build of the project to decrease build time. #carbonads { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "

Continue reading

Author's picture

Wajahat Karim

Android Developer. Open Source Contributor. Writer. Speaker

Senior Android Developer

Karachi, Pakistan