Solutions, Tutorials

Kotlin RecyclerView with Click Listener

Create a RecyclerView in Android with Kotlin – A Step-by-Step Guide In today’s tutorial we’ll learn how to create a RecyclerView in Kotlin for Android with items that are clickable. This approach, distinct from the traditional ListView, offers a more dynamic and flexible way to display a scrollable list. Read on to discover how to […]

Solutions, Tutorials

ListView with ViewHolder in Kotlin

In this post we will create a ListView with ViewHolder adapter but we will write the code in Kotlin. For creating xml files for ListView and list items, follow the steps from this post. Next, you have to create a new Kotlin class for the adapter. Name the new created file MyCustomAdapter MyCustomAdapter.kt import android.content.Context import

Articles, Did You Know?

Kotlin Common Questions

1. Where should we keep constants in Kotlin? if you need constants to be accessed globally use const as top-level properties (not inside a class). In order to do this create a Kotlin file named Constants.kt. The file would look like this: This way you will be able to access the constants from anywhere within the

Tutorials

Kotlin – for, while, if, when

Control flow: for, while, if, when This post is for beginners who want to start learning Kotlin language and already know Java. We will show simple examples of for, while, if, when in both languages, in parallel, for an easier understanding. We will use Log.e in order to print string messages, as from our point of view,

, , , , , , , , , , ,
Articles

Android Activity launchMode

In Android you can specify activity launchMode. You can do this either from AndroidManifest.xml file, either using intents with flags. Some of the flags produce the same effects like those from AndroidManifest.xml, but there are some flags that can be declared only with intents and also there are flags that can be declared only inside

, , , , , , ,
Tutorials

Android Add Game Leaderboard

In order to display leaderboards from your game you will have to set up your project and to be signed in. Below you will learn how to do this. Project Setup Download the Android samples from https://github.com/playgameservices/android-basic-samples Import BaseGameUtils into your project as module  Go to the directory where you downloaded android-basic-samples and select libraries -> BaseGameUtils If you get

, ,
Tutorials

Android ViewPager Tutorial

In Android, if you need to swipe from right to left or vice-versa in order to see different data, you can use a ViewPager. In order to use it, you have to implement a PagerAdapter which will generate the pages that the view shows. ViewPager’s adapters We can use one of the 3 adapters provided:

, , , , , , ,
Tutorials

Android ViewPager Cube Animation

After trying some libraries in order to make a cube animation for my viewPager, I realized that is pretty easy to do this. Android provides an interface called ViewPager.PageTransformer and you just have to implement its method transformPage(). Below is the code, step by step. activity_main.xml <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout 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” tools:context=”ro.helpproject.funcode.help.MainActivity”>

, , , , ,
Articles, Solutions

Android – HTML in textView

Display HTML format First we will present below what are the supported tags for a textView and what are not supported. You can skip this section if you are already familiar with these or you want to jump directly into action :) Supported tags Unsupported tags <a href=”…”> <b> <big> <blockquote> <br> <cite> <del> <dfn>

, , , , , , , , , ,
Exit mobile version