Skip to content

Instantly share code, notes, and snippets.

View ime01's full-sized avatar
💭
Building an app to capture, digitize and preserve the language of the Oras

AndroidPhrophet ime01

💭
Building an app to capture, digitize and preserve the language of the Oras
View GitHub Profile
@nirbhayph
nirbhayph / Data.kt
Last active August 27, 2023 15:43
Kotlin's Flow API -  Combining and Merging Flows for Reactive Programming
/**
* Created by Nirbhay Pherwani on 8/14/2023.
* Linktree - https://linktree.com/nirbhaypherwani
*/
data class Like(val userName: String, val postTitle: String, val reactionName: String)
data class Comment(val userName: String, val postTitle: String, val commentText: String)
data class Post(val userName: String, val postTitle: String)
@codinginflow
codinginflow / MainActivity.java
Created September 25, 2021 14:40
CountDownTimer Tutorial Part 1
package com.codinginflow.countdowntimerexample;
import android.os.CountDownTimer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.Locale;
@joaocruz04
joaocruz04 / android_room_fts4.md
Last active May 21, 2024 04:40
Enabling FTS4 on an Android + Room project

Enabling FTS4 on an Android project with Room

You can do a SQL text query by using the LIKE operator. The issue is that using it requires a lot of computation, as a complete string query is done. Also if you want to have more search options (more fields), your query will grow a lot in complexity. To solve this issue, there's a concept of virtual tables for full text search (FTS).

We will build our solution using Room (already set in the project). We're using version 2.2.0-rc01 for that.

Step 1 - Create new Virtual Table

With Room, the only thing we need is to create the new class with @FTS4 notation. By specifying contentEntity to be the Route class, it means that it will reuse the values from the Route table instead of populating this one with copies. The fields in question should match the ones from the Route table. In this example we only need the title.