Image for post
Image for post

Flutter requires developers to write many boilerplate codes. Android Studio provides a way to solve the problem, which is Live Templates. Live templates allow you to use customized shorthand to write repetitive boilerplate codes. This article will show you how to use Live Templates to minimize the effort to write repeated code.

The image below shows how Live Templates work in Android Studio:


Image for post
Image for post
The damper in Taipei 101 is a sphere made of stacks of flat slabs.

In the quest of finding the most versatile architecture that I can use to create and maintain Flutter apps. I have tried no architecture, Redux, BLoC, InheritedWidget and Provider. Most of them provide unique ways to structure and manage states of widgets and apps. But most of them contains flaws that prevent full utilisation. An example would be Redux, a way to manage app state and very popular among people who did React. …


Image for post
Image for post

Is there a hot JavaScript library that you want to use in Flutter Web but there is no equivalent for it in Dart? You are in luck! Dart was originally a language for internet browsers to begin with so they have this sweet Dart package called the js which you can use to interop between JavaScript and Dart.

To provide an example, we want to access this TypeScript class on the Flutter side. Let’s create a Dog.ts file as shown below. We have

  1. A constructor
  2. Properties of name and age of type string and number respectively.
  3. Getters and Setters for name and age. …


Image for post
Image for post

Android developers are no strangers in writing Gradle scripts to manage dependencies, pull open-source libraries for the applications, set configurations such as using Proguard and product flavours. For those who are unfamiliar with Gradle. It is a build tool that helps us to automate build processes. In this article, I’m going to share how to write and publish a Gradle plugin in Kotlin.

Why do you want to write your own Gradle plugin?

It is to share your build steps across different projects. One such example is building and installing Android applications via Google’s Android Gradle plugin. We do not need to worry about the specific build steps of building Android applications such as finding and compiling the source code, packaging the assets files such as audios, images, and videos, minifying and obfuscate the source code via Proguard among other steps. So that we can dive straight into the Android app dev. …


Image for post
Image for post

My colleagues and I have been experimenting with creating a cross-platform application with Kotlin Multiplatform. I’m excited to share with you on how to write a mobile application with Kotlin Multiplatform using the MVP pattern.

Introduction

Kotlin and Kotlin Multiplatform

Kotlin is designed to interoperate fully with Java and it is the only other official language for Android besides Java. Because Kotlin runs on an LLVM backend, Kotlin can basically be compiled into native/machine code which has compatibility with C and Objective C in various platforms such as Linux, iOS, Android and more. On top of that, it can even be transpiled into javascript/web assembly to drive web applications! …


There is an interesting technology by Google called Flutter. It is a framework where you can create mobile apps on iOS and Android at the same time, like React Native but with a programming language called Dart. I tried it out and I fell in love with it. One of the reasons that I love it is because to create a complete app by using and creating Widgets in a very short amount of time. Other than that, I am very happy with the Flutter development tools that made creating Flutter apps such a joy. …


Image for post
Image for post
Singapore City View: I don’t understand why writers put unrelated pictures in their articles.

How to pass a ByteBuffer from Java to C++ with Djinni

It’s been a while since my last article on Medium (There goes my 2018’s resolution to write an article every month). In NetVirta, I am responsible to integrate a brand new C++ library to an Android library, which itself can be consumed by an Android application be it native applications, React Native or even the spanking hot Flutter which I have so much fun playing with during my own free time.

So I was using Djinni to do all the heavy lifting for me to generate JNI codes. It took me a bit of time to get used to Djinni and I do not regret spending time learning and using it. I shuddered at the thoughts of writing and maintaining them manually. …


Image for post
Image for post

Made easy with Djinni

Now that we are done with the setup and implementing the C++ code on the Android platform. We will continue from where we left off and we’ll try to run our codes on iOS!!

If you don’t know what Djinni is, Check out Part I for the introduction and setup. If you like to know how to use it on Android, check out Part II for the Android implementation.

Apple’s iOS has been using Objective C as the main language to code its app and it integrates quite well with C and C++. Since the release of Swift language, it is still quite easy to integrate Objective C codes to Swift and vice versa. So it seems that linking C++ code and Objective C should be a straightforward affair even without Djinni. BUT… we still need to write Objective C++ codes to link C++ to Objective C and Swift. And it is still quite a complex code to write. …


Image for post
Image for post
The Dvorak keyboard layout

One fine day, my friend came over to my place. I allowed her to use my laptop. As she happily started typing on Google Search. An incoherent strings of letters came out:

tsfaodalghgskeism

“What the heck is this?” she gasped.

I looked at the screen and instantly know what’s going on. So I pressed on left Ctrl and Shift at the same time to change the layout back to US Keyboard.

“I’m using a different keyboard layout.” I explained “I just casted a spell on it. You can type normally now.”

“Why can’t you use the normal keyboard like all the normal person would?” Her words were repeated by many of my friends, colleagues, and my family members that were unfortunate enough to use my computers since then. …


Image for post
Image for post

Integrating C++ code in Android

Update: I have made some updates to the Part I to make things work in this post.

This is a continuation of the last post. If you haven’t read it yet, I advise you to read it first. :)

This time we’ll use the generated codes created by Djinni that was shown in Part I and implement it to an Android application.

We’ll follow the project structure based on this Hello World Tutorial and create a folder and name it AndroidApplication on our project root. So our structure will look like this.

CPPCalculator
|
|-generated
|-src
|-AndroidApplication

Next we’ll fire up Android Studio and Create a New Project and set the project location in the folder we just created. We’ll check the Include C++ support checkbox. …

About

JT Liew

Mobile developer; Netvirta; GDG Kuala Lumpur; Dog lover #fullstack #android #kubernetes #laravel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store