Skip to content

Commit 41ca173

Browse files
android example
1 parent eebf250 commit 41ca173

40 files changed

+1050
-0
lines changed

examples/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
### Idea examples
44
* [plugin example](kotlin-dataframe-plugin-example) IDEA project with a
55
[Kotlin DataFrame Compiler Plugin](https://kotlin.github.io/dataframe/compiler-plugin.html) example.
6+
* [android example](android-example) A minimal Android project showcasing integration with Kotlin DataFrame.
7+
Also includes [Kotlin DataFrame Compiler Plugin](https://kotlin.github.io/dataframe/compiler-plugin.html).
68
* [movies](idea-examples/movies) Using extension properties [Access API](https://kotlin.github.io/dataframe/apilevels.html) to perform a data cleaning task
79
* [titanic](idea-examples/titanic)
810
* [youtube](idea-examples/youtube)

examples/android-example/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

examples/android-example/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 📱 Android Example
2+
3+
A minimal Android project showcasing integration with **Kotlin DataFrame**.
4+
5+
<p align="center">
6+
<img src="screen.jpg" alt="App screenshot" height="320"/>
7+
</p>
8+
9+
It also includes the [Kotlin DataFrame Compiler Plugin](https://kotlin.github.io/dataframe/compiler-plugin.html).
10+
11+
> **Note:** The generated [extension properties](https://kotlin.github.io/dataframe/extensionpropertiesapi.html)
12+
> may not be highlighted correctly in current stable versions of Android Studio due to limited IDE support.
13+
> However, they work as expected at runtime and during compilation.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.kotlin.compose)
5+
kotlin("plugin.dataframe") version "2.2.20-Beta1"
6+
}
7+
8+
android {
9+
namespace = "com.example.myapplication"
10+
compileSdk = 36
11+
12+
defaultConfig {
13+
applicationId = "com.example.myapplication"
14+
minSdk = 26
15+
targetSdk = 36
16+
versionCode = 1
17+
versionName = "1.0"
18+
19+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
20+
}
21+
22+
buildTypes {
23+
release {
24+
isMinifyEnabled = false
25+
proguardFiles(
26+
getDefaultProguardFile("proguard-android-optimize.txt"),
27+
"proguard-rules.pro"
28+
)
29+
}
30+
}
31+
compileOptions {
32+
sourceCompatibility = JavaVersion.VERSION_1_8
33+
targetCompatibility = JavaVersion.VERSION_1_8
34+
}
35+
kotlinOptions {
36+
jvmTarget = "1.8"
37+
}
38+
buildFeatures {
39+
compose = true
40+
}
41+
packaging {
42+
resources {
43+
pickFirsts += listOf(
44+
"META-INF/AL2.0",
45+
"META-INF/LGPL2.1",
46+
"META-INF/ASL-2.0.txt",
47+
"META-INF/LICENSE.md",
48+
"META-INF/NOTICE.md",
49+
"META-INF/LGPL-3.0.txt",
50+
"META-INF/thirdparty-LICENSE",
51+
)
52+
excludes += listOf(
53+
"META-INF/kotlin-jupyter-libraries/libraries.json",
54+
"META-INF/{INDEX.LIST,DEPENDENCIES}",
55+
"{draftv3,draftv4}/schema",
56+
"arrow-git.properties",
57+
)
58+
}
59+
}
60+
}
61+
62+
dependencies {
63+
64+
implementation(libs.androidx.core.ktx)
65+
implementation(libs.androidx.lifecycle.runtime.ktx)
66+
implementation(libs.androidx.activity.compose)
67+
implementation(platform(libs.androidx.compose.bom))
68+
implementation(libs.androidx.ui)
69+
implementation(libs.androidx.ui.graphics)
70+
implementation(libs.androidx.ui.tooling.preview)
71+
implementation(libs.androidx.material3)
72+
testImplementation(libs.junit)
73+
androidTestImplementation(libs.androidx.junit)
74+
androidTestImplementation(libs.androidx.espresso.core)
75+
androidTestImplementation(platform(libs.androidx.compose.bom))
76+
androidTestImplementation(libs.androidx.ui.test.junit4)
77+
debugImplementation(libs.androidx.ui.tooling)
78+
debugImplementation(libs.androidx.ui.test.manifest)
79+
80+
implementation("org.jetbrains.kotlinx:dataframe:1.0.0-dev-7831")
81+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"metadata": {
6+
"collapsed": true,
7+
"ExecuteTime": {
8+
"end_time": "2025-07-25T11:25:31.644164Z",
9+
"start_time": "2025-07-25T11:25:31.642561Z"
10+
}
11+
},
12+
"source": [
13+
""
14+
],
15+
"outputs": [],
16+
"execution_count": null
17+
},
18+
{
19+
"metadata": {
20+
"ExecuteTime": {
21+
"end_time": "2025-07-25T11:25:42.768839Z",
22+
"start_time": "2025-07-25T11:25:42.767006Z"
23+
}
24+
},
25+
"cell_type": "code",
26+
"source": "",
27+
"outputs": [],
28+
"execution_count": null
29+
},
30+
{
31+
"metadata": {
32+
"ExecuteTime": {
33+
"end_time": "2025-07-25T11:25:58.201672Z",
34+
"start_time": "2025-07-25T11:25:58.199772Z"
35+
}
36+
},
37+
"cell_type": "code",
38+
"source": "",
39+
"outputs": [],
40+
"execution_count": null
41+
},
42+
{
43+
"metadata": {
44+
"ExecuteTime": {
45+
"end_time": "2025-07-25T11:26:02.668074Z",
46+
"start_time": "2025-07-25T11:26:02.619066Z"
47+
}
48+
},
49+
"cell_type": "code",
50+
"source": "1",
51+
"outputs": [
52+
{
53+
"data": {
54+
"text/plain": [
55+
"1"
56+
]
57+
},
58+
"execution_count": 2,
59+
"metadata": {},
60+
"output_type": "execute_result"
61+
}
62+
],
63+
"execution_count": 2
64+
},
65+
{
66+
"metadata": {},
67+
"cell_type": "code",
68+
"outputs": [],
69+
"execution_count": null,
70+
"source": ""
71+
}
72+
],
73+
"metadata": {
74+
"kernelspec": {
75+
"display_name": "Kotlin",
76+
"language": "kotlin",
77+
"name": "kotlin"
78+
},
79+
"language_info": {
80+
"name": "kotlin",
81+
"version": "1.9.23",
82+
"mimetype": "text/x-kotlin",
83+
"file_extension": ".kt",
84+
"pygments_lexer": "kotlin",
85+
"codemirror_mode": "text/x-kotlin",
86+
"nbconvert_exporter": ""
87+
},
88+
"ktnbPluginMetadata": {
89+
"projectDependencies": [
90+
"Simple_Kotlin_DataFrame_Application.app.main"
91+
],
92+
"projectLibraries": false
93+
}
94+
},
95+
"nbformat": 4,
96+
"nbformat_minor": 0
97+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.example.myapplication
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.example.myapplication", appContext.packageName)
23+
}
24+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:dataExtractionRules="@xml/data_extraction_rules"
8+
android:fullBackupContent="@xml/backup_rules"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.MyApplication" >
14+
<activity
15+
android:name=".MainActivity"
16+
android:exported="true"
17+
android:label="@string/app_name"
18+
android:theme="@style/Theme.MyApplication" >
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
</intent-filter>
24+
</activity>
25+
</application>
26+
27+
</manifest>

0 commit comments

Comments
 (0)