Add datasets/android/
Based on https://www.hanshq.net/command-line-android.html. See [Benjamin-Loison/android/issues/30](https://github.com/Benjamin-Loison/android/issues/30).
This commit is contained in:
parent
53c3935bab
commit
92aa5a3558
15
datasets/android/AndroidManifest.xml
Normal file
15
datasets/android/AndroidManifest.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="net.hanshq.hello"
|
||||
versionCode="1"
|
||||
versionName="0.1">
|
||||
<uses-sdk android:minSdkVersion="33"/>
|
||||
<application android:label="Hello">
|
||||
<activity android:name=".MainActivity" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
20
datasets/android/java/net/hanshq/hello/MainActivity.java
Normal file
20
datasets/android/java/net/hanshq/hello/MainActivity.java
Normal file
@ -0,0 +1,20 @@
|
||||
package net.hanshq.hello;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.content.Context;
|
||||
import android.os.BatteryManager;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
TextView text = (TextView)findViewById(R.id.my_text);
|
||||
Context context = getApplicationContext();
|
||||
BatteryManager batteryManager = (BatteryManager)context.getSystemService(Context.BATTERY_SERVICE);
|
||||
text.setText("Hello, worldeee!" + batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER));
|
||||
}
|
||||
}
|
14
datasets/android/res/layout/activity_main.xml
Normal file
14
datasets/android/res/layout/activity_main.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/my_text"/>
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user