Skip to content

Java System API

Java system APIs live under sdk/java/picodroid/ and mirror the Android API surface. Native implementations are in platforms/rp/src/system/picodroid/.

The reference is split by package family. Pick the area you need.

AreaPackagesCovers
Core languagejava.lang, java.utilString (incl. String.format), StringBuilder, Math, wrapper classes, exceptions, Random, ArrayList, HashMap / HashSet, Iterator / for-each, enums, Arrays / Collections / List / Comparable, Class, AutoCloseable
System & concurrencypicodroid.util, picodroid.os, picodroid.concurrentLog, SystemClock, System.currentTimeMillis, Runtime (GC stats), Thread, Executors (main-thread FIFO + background pool)
Services & DI (Preview)picodroid.app, picodroid.content, javax.inject, picodroid.diService / IBinder / Notification, bindService / startService, ServiceConnection, compile-time DI (@Inject / @Singleton, @Module / @Provides, Provider<T> / Lazy<T>, automatic injection of Application / Activity / Service), manual DI components (ApplicationComponent, ActivitySingletonComponent)
Peripheralspicodroid.pioPeripheralManager, Gpio, UartDevice, I2cDevice, SpiDevice, Pwm, Adc, AutoCloseable idiom
Storagepicodroid.io, picodroid.contentFile / FileInputStream / FileOutputStream (LittleFS), SharedPreferences / Editor
Networkingpicodroid.netSocket, ServerSocket, DatagramSocket, DatagramPacket, InetAddress, NetworkInfo, HttpURLConnection + URL (Pico 2 W on hardware; sim always works)
Sensorspicodroid.hardwareSensorManager, Sensor, SensorEvent, SensorEventListener — BME688 (temperature / humidity / pressure / gas), LTR559 (light / proximity)
Graphics & UIpicodroid.app, picodroid.graphics, picodroid.view, picodroid.widget, picodroid.debugApplication / Activity full lifecycle + back stack, Display / DisplayDebug, Color, Theme, GradientDrawable, View (incl. animate(), per-View touch, focus nav), ViewGroup, MotionEvent, GestureDetector, ViewPropertyAnimator, KeyEvent / OnKeyListener, OnSwipeListener, typed listener interfaces, the Adapter / ArrayAdapter pattern, 20+ widgets including Toast, AlertDialog, Keyboard, DatePicker, TimePicker, Snackbar, SwipeRefreshLayout, ImageView

Quick example

A complete mini-app that opens a GPIO pin, blinks it, and logs the result. See Peripherals for the full PIO surface and System & concurrency for Log and SystemClock.

package myapp;
import picodroid.util.Log;
import picodroid.os.SystemClock;
import picodroid.pio.PeripheralManager;
import picodroid.pio.Gpio;
public class MyApp {
public static void main(String[] args) {
PeripheralManager pm = PeripheralManager.getInstance();
try (Gpio led = pm.openGpio("GP25")) {
led.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW);
for (int i = 0; i < 5; i++) {
led.setValue(true);
SystemClock.sleep(500);
led.setValue(false);
SystemClock.sleep(500);
Log.i("MyApp", "Blink " + String.valueOf(i + 1));
}
}
}
}