Skip to content

Public API

This is the supported surface exported by apkpy_lib. Import individual names for clarity:

from apkpy_lib import Screen, Theme, button, label, run

App structure

API Purpose
Screen(id, background_image=None, scroll=False) Defines an Android screen/Activity
run(start_screen=None, theme=None) Starts the Previewer and defines the app entry
Theme(...) Supplies global design tokens and component defaults
device(name) Selects a Previewer device preset or responsive mode
declare_permissions(perms) Adds Android manifest permissions

Screen methods:

Method Purpose
get_param(key, default="") Reads a value passed during navigation
on_click_navigate(button, to, data=None) Connects an existing button to a screen

Components

API Important arguments
label text, id, variant, screen, parent
button text, command, variant, icon
inputs / input_field placeholder, type, on_change
image local path or HTTPS URL in src
container composable parent surface
card title, subtitle, image, content, actions and variant
card_action detached action for semantic cards
list_view items, click callback and optional rich rows
carousel horizontal rich-item shelf
grid rich-item grid with cols
spinner circular loading indicator
skeleton animated content placeholder
empty_state empty result with optional action
error_state error result with optional retry

Common component methods:

Method Purpose
get_value() Reads the current input/value
set_value(value) Updates text, image or input state where supported
show() / hide() Controls visibility
set_items(items, ...) Replaces list/carousel/grid content

Layout

API Purpose
row(*children) Describes a horizontal arrangement
column(*children) Describes a vertical arrangement
responsive(mobile, tablet=None, landscape=None, breakpoint=600, ...) Switches arrangements by viewport
API Purpose
on_click_navigate(screen, data=None) Navigates from a callback
bottom_nav(screens, labels=None, icons=None) Adds top-level bottom navigation
app_bar(...) Adds a fixed Material toolbar
sliver_app_bar(...) Adds a collapsible image toolbar
action(icon, ...) Creates an app-bar icon action
mini_player(open=None) Adds the persistent audio mini-player

Overlays and feedback

API Purpose
bottom_sheet Selectable Material bottom sheet
modal Confirm/cancel modal
menu / popup_menu Anchored compact menu
context_menu Right-click/long-press menu
tooltip Accessible help attached to a component
date_picker / time_picker Native date/time selection
snackbar Transient message with optional action
toast Brief platform message
alert / confirm Native informational/confirmation dialogs

Overlay definitions returned by sheets, modals, menus and pickers expose open() and close().

Data and security

Object/helper Methods
storage set, get, delete, clear, keys
crypto hash_password, verify_password, encrypt, decrypt
db execute, query, last_insert_id, begin, commit, rollback
https get, post, put, patch, delete
json_get(json_string, path) Reads a safe dotted JSON path
random randint, choice, random
datetime now, date, time, and numeric date/time parts

Media, files and identity

Object/helper Methods
audio playback, background playback, seek, queue, controls, favourites and playlists
files download, path, exists, delete
auth login, user, token, is_logged_in, logout

Audio methods:

play, play_background, pause, resume, stop, seek, play_playlist, next, previous, shuffle, repeat, now_playing, controls, is_liked, toggle_like, like_button, liked_list, add_to_playlist, play_saved_playlist, playlists_list, edit_playlist, playlist_editor, remove_from_playlist and delete_playlist.

Device integrations

Object/API Purpose
permissions Runtime Android permission requests
notify System notifications
share Native share sheet
clipboard System clipboard
camera Native camera capture
gallery Native media picker
location Current position and city
service Periodic and one-shot background work
apps Installed-app listing, permissions, extraction and hashing

For behavior and security notes, use the topic guides rather than relying on this compact index alone.