Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
android example
  • Loading branch information
AndreiKingsley committed Jul 25, 2025
commit 41ca17353777fa0095c905c13a65c51fd8cea2ad
2 changes: 2 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### Idea examples
* [plugin example](kotlin-dataframe-plugin-example) IDEA project with a
[Kotlin DataFrame Compiler Plugin](https://kotlin.github.io/dataframe/compiler-plugin.html) example.
* [android example](android-example) A minimal Android project showcasing integration with Kotlin DataFrame.
Also includes [Kotlin DataFrame Compiler Plugin](https://kotlin.github.io/dataframe/compiler-plugin.html).
* [movies](idea-examples/movies) Using extension properties [Access API](https://kotlin.github.io/dataframe/apilevels.html) to perform a data cleaning task
* [titanic](idea-examples/titanic)
* [youtube](idea-examples/youtube)
Expand Down
15 changes: 15 additions & 0 deletions examples/android-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
13 changes: 13 additions & 0 deletions examples/android-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 📱 Android Example

A minimal Android project showcasing integration with **Kotlin DataFrame**.

<p align="center">
<img src="screen.jpg" alt="App screenshot" height="320"/>
</p>

It also includes the [Kotlin DataFrame Compiler Plugin](https://kotlin.github.io/dataframe/compiler-plugin.html).

> **Note:** The generated [extension properties](https://kotlin.github.io/dataframe/extensionpropertiesapi.html)
> may not be highlighted correctly in current stable versions of Android Studio due to limited IDE support.
> However, they work as expected at runtime and during compilation.
1 change: 1 addition & 0 deletions examples/android-example/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
81 changes: 81 additions & 0 deletions examples/android-example/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
kotlin("plugin.dataframe") version "2.2.20-Beta1"
}

android {
namespace = "com.example.myapplication"
compileSdk = 36

defaultConfig {
applicationId = "com.example.myapplication"
minSdk = 26
targetSdk = 36
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
packaging {
resources {
pickFirsts += listOf(
"META-INF/AL2.0",
"META-INF/LGPL2.1",
"META-INF/ASL-2.0.txt",
"META-INF/LICENSE.md",
"META-INF/NOTICE.md",
"META-INF/LGPL-3.0.txt",
"META-INF/thirdparty-LICENSE",
)
excludes += listOf(
"META-INF/kotlin-jupyter-libraries/libraries.json",
"META-INF/{INDEX.LIST,DEPENDENCIES}",
"{draftv3,draftv4}/schema",
"arrow-git.properties",
)
}
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)

implementation("org.jetbrains.kotlinx:dataframe:1.0.0-dev-7831")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe some note about which version to use?

Copy link
Collaborator Author

@AndreiKingsley AndreiKingsley Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYM? I'd just like release version to be here (mow Beta-2 doesn't work, so I use dev).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementation("org.jetbrains.kotlinx:dataframe:1.0.0-dev-7831")
For Android maybe it's worth to use core + json etc. dataframe includes apache arrow that, as we now know, doesn't work on Android =(

}
97 changes: 97 additions & 0 deletions examples/android-example/app/keks.ipynb
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test file? :P

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"cells": [
{
"cell_type": "code",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-07-25T11:25:31.644164Z",
"start_time": "2025-07-25T11:25:31.642561Z"
}
},
"source": [
""
],
"outputs": [],
"execution_count": null
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-07-25T11:25:42.768839Z",
"start_time": "2025-07-25T11:25:42.767006Z"
}
},
"cell_type": "code",
"source": "",
"outputs": [],
"execution_count": null
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-07-25T11:25:58.201672Z",
"start_time": "2025-07-25T11:25:58.199772Z"
}
},
"cell_type": "code",
"source": "",
"outputs": [],
"execution_count": null
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-07-25T11:26:02.668074Z",
"start_time": "2025-07-25T11:26:02.619066Z"
}
},
"cell_type": "code",
"source": "1",
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 2
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": ""
}
],
"metadata": {
"kernelspec": {
"display_name": "Kotlin",
"language": "kotlin",
"name": "kotlin"
},
"language_info": {
"name": "kotlin",
"version": "1.9.23",
"mimetype": "text/x-kotlin",
"file_extension": ".kt",
"pygments_lexer": "kotlin",
"codemirror_mode": "text/x-kotlin",
"nbconvert_exporter": ""
},
"ktnbPluginMetadata": {
"projectDependencies": [
"Simple_Kotlin_DataFrame_Application.app.main"
],
"projectLibraries": false
}
},
"nbformat": 4,
"nbformat_minor": 0
}
21 changes: 21 additions & 0 deletions examples/android-example/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.myapplication

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.myapplication", appContext.packageName)
}
}
27 changes: 27 additions & 0 deletions examples/android-example/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" >

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication" >
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.MyApplication" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Loading