Today, I had a huge Json in my app and I wanted to fetch all these values in a general way. I also wanted to parse Json for only one time to avoid try/catch each time I access any value. So, first thing I had in mind was to convert the JSONObject in the HashMap or Map<> etc. So if you are using Gson in your apps for json mapping, then you can use this one line code for conversion.

Continue reading

I don’t know much about this but I will try my best! Photo of Deosai Plains (Pakistan) February 2018. I left my previous job and started looking for a new job. I had some interviews lined up. I had 7+ years of hands-on experience on mobile development, two world wide published books on Android, few open source libraries and a good portfolio. What I didn’t have was the self esteem and confidence.

Continue reading

To showing/hiding the password dots in the EditText in android, here’s the easy one-line way. Here’s the dummy layout with an EditText and a CheckBox for toggling the password dots. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="16dp" android:orientation="vertical"> <EditText android:id="@+id/edtPassword" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Enter password" android:inputType="textPassword" /> <android.support.v7.widget.AppCompatCheckBox android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Show Password" /> </LinearLayout> Now, you can toggle the password on the OnCheckedChangeListener using this snippet. checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean value) { if (value) { // Show Password edtPassword.

Continue reading

I have always been more focused on writing and reading medium than the listening and speaking. But, recently I have started giving talks and doing public speaking a little. And I must say that I have been enjoying it a lot. And then an opportunity knocked my door and presented an other option for me to explore. That was podcasting and sharing my knowledge through audio channels. I have never created or talked in any podcast, so I was curious and interested at same time to explore this and see how this plays for me.

Continue reading

I woke up at around 5:30 AM in morning. I was feeling very sleepy as I slept late at night. But it was no time for laziness as I had to get ready for traveling. I made tea and ate some bread as quick breakfast, got shower, locked my home and called Uber. Uber took me to a bus stop where I booked a seat in a bus. The bus was late about 20 minutes, but I left Karachi — the city of lights — at 7:20 AM.

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

The Road to 1000 Followers on Medium Since the childhood, I have remained a silent but talkative person. Now you must be thinking about how someone can be silent as well as talkative both at same time. There’s no middle ground in those two attributes. Well, my answer to that is at start I am a shy and silent person to any new person. But when I become comfortable to him/her, then I think (s)he can’t stop my on talking.

Continue reading

Author's picture

Wajahat Karim

Android Developer. Open Source Contributor. Writer. Speaker

Senior Android Developer

Karachi, Pakistan