Thank you Android!

    I just finished reading Androids by Chet Haase, about the development journey of the Android platform towards the 1.0 release. First of all, this book is important to me. Besides that I am currently an Android developer myself but because I started my passion in professional programming as an Android developer back in 2011. Technically I started as a PHP programmer but I hated it back then. Look, I am not in Silicon Valley or the USA, I am in a small city in the Philippines where doctors and engineers are more prestigious than programmers.

    Read More

    iOS 15 Button Title

    If you encountered default titles on your UIButton when using setImage() like my situation below. As you can see on the screenshot below, I removed the title. So everything should be alright. And when I run it on my iOS 15 device. What the. Anyway, solution is simple. On your UIButton's Atrribute inspector, set the style to default and remove the default Button title. Let me know if you have any questions.

    Read More

    Realm Kotlin Tutorial

    First things first, make sure you followed the official Realm tutorial on how to install it on your Android project. Here's how I implemented it on my Android project using Kotlin. After installation, initialize the Realm instance on your Application class or your launcher Activity. import android.app.Application import io.realm.Realm class MyApplication : Application() { override fun onCreate() { super.onCreate() Realm.init(this) } } Create your Realm object by extending the RealmObject class.

    Read More

    Call Multiple APIs using Coroutines

    Every time my app starts, I need to call 2-3 URL endpoints to get the latest data from the API. Every app encounters this scenario one way or another. I need to know when each API call finishes so that I can prompt the user a Snackbar or dialog to indicate that I already got the latest data. And more importantly, I made sure that calling the function 2-3 times won't block the main thread.

    Read More

    Bluetooth printer scanning using Kotlin

    One of the requirements of my current project is to be able to establish Bluetooth connection and send texts to print. See the video below for the result. Let's create an empty Android project and let's call it BluetoothPrintingSample. Then, create a layout folder inside res folder. Let's create a simple layout called activity_print.xml. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingStart="44dp" android:paddingEnd="44dp" android:background="@color/design_default_color_secondary" > <EditText android:id="@+id/editTextPrintMessage" android:layout_width="match_parent" android:layout_height="200dp" android:singleLine="false" android:background="@android:color/white" android:textColor="

    Read More

    My 9th Google I/O

    This week was all about Google I/O and this year was my 9th year watching the event. I enjoyed this year’s event compared to the last 2-3 years. It reminded me of when Google introduced Holo theme and Material Design. This year they introduced Material You. On the technical side, they introduced a bunch of updates to Jetpack and Jetpack Compose. And I’m excited to migrate some of my old codebases to Jetpack.

    Read More

    Pass list of objects in Intent using Kotlin

    Every Android developer is familiar with passing data between Activities using Bundle. The old Java way was to implement Parcelable class and then you override all the required methods. See example below. You can read more of the details here. public class MyParcelable implements Parcelable { private int mData; public int describeContents() { return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mData); } public static final Parcelable.Creator<MyParcelable> CREATOR = new Parcelable.

    Read More

    OnlineJobs for iOS (v4.5.2) Bug

    Last week, it was one of those times where you know something went wrong when suddenly you get multiple Slack notifications. I received a Slack notification for every minute, I had to mute the channel. When I open the Bugsnag dashboard, I could see it was affecting hundreds of users. As of this moment, 154 users. Yikes! What took me so long was that Bugsnag wasn't able to capture all the other threads.

    Read More

    Bintray Shutting Down

    Next month, JFrog will shut down JCenter and Bintray and my experience with their service will go along with them. Before Gradle, and all this new Android artifacts/dependencies repositories, Bintray was the most popular back in 2015. During that year, I was able to publish an Android package called Networking Valley, it's still open source to this day. I called it Networking Valley to pay homage to a popular mobile game called Monumental Valley.

    Read More

    Dynamic TableViewCell Height

    I'm going to demonstrate on how I achieved the dynamic height for my UITableViewCell. Below is what it looks like. This is a UITableViewCell for comments. ImageView on the left side is for the user's avatar, the top most UILabel is for the username and lastly at the bottom is the UILabel for comment. Yes don't mind the red warnings, that is by design. The important here is for the UITableViewCell height to expand with AutoLayout.

    Read More

    Nobody designs for small iPhone devices anymore

    Nobody designs for small iPhone devices anymore. Why do I say this? Well, if you've been rocking the iPhone SE 2020 you would know. What I'm saying is there a lot of UI glitches from apps running on iPhone SE. Clubhouse Forgot to measure the screen's width? Spotify I can't see the Refresh button. I have to scroll up with my left thumb and then tap Refresh on my right.

    Read More

    Code Refactoring: First Loom Video

    In programming, you always encounter duplicate code blocks. The best thing to do is to place it in a separate function so that we can reuse it throughout our source code. [www.loom.com/share/9e5...](https://www.loom.com/share/9e5bf20a80eb4a2bac0fb4d8e71f957f)

    Keepr Storage Bug

    Last year, I found a bug on Keepr Storage's Android app. It has the same bug as of Globe Telecom's where the API endpoint was not using secure HTTP. As a result, I can see my data in plaintext over Wi-Fi. Using Wireshark But as of version v1.3.6 of their app, this bug has been fixed already. They didn't respond to my email last year though.

    Play Looping Video using Swift

    Playing a looping video in iOS is fairly simple but there's a catch. You need to declare AVPlayerLooper global in your class. Below is the code: let avPlayerItem = AVPlayerItem(url: videoOutputURL!) let avQueuePlayer = AVQueuePlayer(playerItem: avPlayerItem) let avPlayerLayer = AVPlayerLayer(player: avQueuePlayer) avPlayerLooper = AVPlayerLooper(player: avQueuePlayer, templateItem: avPlayerItem) avPlayerLayer.frame = videoPlayContainerView.bounds avPlayerLayer.videoGravity = .resizeAspectFill avQueuePlayer.actionAtItemEnd = .none videoPlayContainerView.layer.addSublayer(avPlayerLayer) avQueuePlayer.play() The videoPlayContainerView is a UIView.

    Government and its Test Pages

    Philippine government sites are filled with "Test Pages". Not sure if this is just pure incompetence. Or a honeypot. Or lack of budget. [dict.gov.ph/test-page...](https://dict.gov.ph/test-page-2/) Yes, this department should know better considering IT is its main function. https://www.gov.ph/en/test-page?p_p_id=com_liferay_login_web_portlet_LoginPortlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&saveLastPath=false&_com_liferay_login_web_portlet_LoginPortlet_mvcRenderCommandName=%2Flogin%2Flogin How about test page and sign in page combined. Nice. [www.gov.ph/test-page](https://www.gov.ph/test-page) How about a broken CSS currently live. [bfp.gov.ph/test-page...](https://bfp.gov.ph/test-page/#.YCuH_y0RpB0) Another one. (DJ Khaled voice) Even valid looking pages are still /test-page/

    Most active GitHub users in the Philippines

    Just came upon this site while I was browsing, https://commits.top/philippines_private.html Based on the ranking as of today, I am number 17 on the list.

    Create a camera shutter in Swift

    I'm going to show how I achieved the camera shutter button and animation using Swift, more or less the same with the stock iOS camera app. Grab a coffee because this one's going to be a little longer. Storyboard UI On your ViewController, drag a UIButton and place it at the bottom part. On the Size Inspector, give it a width and height of 65, thus creating a perfect square.

    Read More

    Create a custom camera preview using Swift

    If you are looking to create your own camera on iOS, I will demonstrate how I did it on my end. CameraPreviewView First of all you need to subclass UIView and inherit its properties. We will use this Swift file for our camera preview. import UIKit import AVFoundation class CameraPreviewView: UIView { override class var layerClass: AnyClass { return AVCaptureVideoPreviewLayer.self } var videoPreviewLayer: AVCaptureVideoPreviewLayer { return layer as! AVCaptureVideoPreviewLayer } var session: AVCaptureSession?

    Read More