Hi there.Welcome to another episode of “Compose in the Room”. In this episode, we will see how easy it is to integrate Exoplayer in Jetpack Compose. As you might have realized, there is no composable for Exoplayer in Jetpack Compose but Jetpack Compose is fully interoperable with the view system and so, we are good to go. There are different ways of using Android views in Compose but here, we will use AndroidView composable. AndroidView is useful when we want to integrate a view that is not yet available in Compose such as MapView for example. …
In this episode, we will look into common ways in which we place items in a composable on the screen.
As the name sounds, this composable helps us to place items from top to bottom. It is the equivalent of a vertical LinearLayout in the view based system.To achieve this, we create a composable function and wrap the children items in a Column composable as shown below
The @Preview annotation helps us to visualize how the composable will look without necessarily running it on the device. You still have the option to preview it on the device though. …
At the time of this writing, one can only develop with Jetpack Compose using Android studio preview(Arctic Fox 2020.3.1 Beta 4). You can get it from here
I know you might be wondering and thinking that I will be explaining all the little details to you on how Jetpack Compose was crafted, etc but that is not the purpose. Our aim will be for us to just learn by building actual interfaces, etc. Sorry if I didn’t do a proper introduction of what Jetpack Compose is(we will be focusing on Jetpack Compose UI)
In simple terms, it is a declarative way of building interfaces and specifically on Android, we do not need to use fragments but rather, our interfaces are functions known as composables. …
Hello to you reading once more(it is going to be really short) and welcome as well if you are new. There are tons of materials online to learn anything, but most of the time, many materials are confused and you are stuck with switching from one course to another.
In this post, I recommend some resources which are very helpful to start Android development from scratch. Most, if not all, will be free resources. Okay lets us go.
In simple terms, we want to ensure that as a user types into the TextField, hyphens are automatically added at various positions
To simplify the scenario, let us implement visual transformation for a local Cameroon phone number. A Cameroonian phone number has 9 digits, that is of the form,
We want it to be transformed to
For Jetpack Compose, we will have to implement the VisualTransformation interface. Let us have the full source code and have the explanation below
The offset mapping works such that the method originalToTransformed converts offsets in the original text to transformed…
We have been hearing about Jetpack Compose for a while now and as announced at Google I/O 2021, Compose will be stable come July. Jetpack Compose gives us a declarative way of building UIs on the Android platform. Let us explore how to select an image from the gallery and display it in an Image Composable.
Of course, we will be using the Activity Result APIs which simplifies our task and we do not need to deal with request codes. Enough of the long talk, let us create our composable and I will explain below.
We start by declaring…
In simple terms, how do you parse a response such as that from https://covid-api.mmediagroup.fr/v1/cases . We may be expecting the the object will have a list of countries but instead, the countries are keys.We will write a simple utility function to grab all keys from the JsonObject and iterate through the keys to generate a list of countries.
In essence, we will create a simple data class called country to hold basic Covid 19 data as follows
Great we are good to go from here. Note that each country has a JsonObject again inside with key, “All” and we…
First things first, start by creating an android studio project in Android Studio and add the material design dependency in the app level build.gradle file
Next, we drag a button from the designer tool onto the activity_main layout file to show the date picker when the button is clicked. We also add a text view to display the selected date.
// Create the date picker builder and set the…
This is one of those random posts that I set in to write after long months of no writing or blog posts and I really feel bad about it but seemingly I feel justified by my own laziness for being this lazy and dropping nothing about programming.
Why have I been unable to put aside just a second to do what makes me happy 😠. Enough of the questions, let me change the subject.
How often do you end the day feeling happy about doing something you didn’t expect to do? That was the feeling I had a week ago…
Mobile app developer. Co-founder @ Njaka.Previously Android/UX developer mentor @ Udacity.#JetpackCompose #SwiftUI