skillfed

android-java

This skill equips Android developers with a deep understanding of MVVM (Model-View-ViewModel) architecture and ViewModel patterns essential for modern Java-based mobile applications. Learn how to structure your codebase for testability, maintainability, and separation of concerns while implementing lifecycle-aware components that handle configuration changes gracefully.

android-java teaches MVVM (Model-View-ViewModel) architecture as a foundational pattern for structuring Android applications with clear separation of concerns. The ViewModel pattern, a core component of MVVM, allows you to store and manage UI-related data in a lifecycle-aware manner. ViewModels survive configuration changes like screen rotations, ensuring your data persists without leaking context or causing memory issues. This architecture makes your code more testable and maintainable by decoupling UI logic from business logic.

AI-generated summary based on this skill's SKILL.md

703 56 MIT updated by alinaqi

Install

alinaqi/maggy/android-java · repository language: Python

CLI (skillfed)coming soon
git clone https://github.com/alinaqi/maggy
cp -r maggy/skills/android-java ~/.claude/skills/android-java

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What is MVVM architecture and how does android-java implement ViewModel patterns?

android-java teaches MVVM (Model-View-ViewModel) architecture as a foundational pattern for structuring Android applications with clear separation of concerns. The ViewModel pattern, a core component of MVVM, allows you to store and manage UI-related data in a lifecycle-aware manner. ViewModels survive configuration changes like screen rotations, ensuring your data persists without leaking context or causing memory issues. This architecture makes your code more testable and maintainable by decoupling UI logic from business logic.

How do you implement ViewBinding and safe UI updates in Activities and Fragments?

android-java covers ViewBinding as a type-safe replacement for findViewById() that automatically generates binding classes for your layouts. By using ViewBinding in both Activities and Fragments, you eliminate null pointer exceptions and get compile-time safety. The skill demonstrates how to properly initialize bindings in each component's lifecycle, ensuring views are accessed only when the layout is inflated and avoiding reference leaks by nullifying bindings in onDestroyView() for Fragments.

What testing frameworks does android-java use for unit and instrumentation tests?

android-java teaches comprehensive testing using JUnit for unit tests, Mockito for mocking dependencies, and Espresso for instrumentation testing. JUnit provides the foundation for testing business logic and ViewModels in isolation, Mockito allows you to create mock objects and verify interactions without hitting real dependencies, and Espresso enables you to write reliable UI tests that interact with your Activities and Fragments. Together, these frameworks ensure your Android application is thoroughly tested at multiple levels.

How can you avoid common Android pitfalls like memory leaks, context leaks, and threading issues?

android-java emphasizes best practices for preventing memory leaks by properly managing lifecycle callbacks, avoiding holding strong references to Context in long-lived objects, and using WeakReferences when necessary. Context leaks are prevented by using Application context instead of Activity context where appropriate. Threading issues are mitigated by understanding the main thread constraint, using LiveData for thread-safe UI updates, and leveraging coroutines or background executors for long-running operations. The skill provides patterns to identify and eliminate these anti-patterns early in development.

How do you set up Gradle build configuration and CI/CD pipelines for Android projects?

android-java guides you through configuring Gradle for Android projects, including dependency management, build variants, and custom build tasks. The skill covers setting up CI/CD pipelines using GitHub Actions to automate testing, building, and deployment workflows. You'll learn to configure lint rules to enforce code quality standards across your team, integrate static analysis tools, and establish automated checks that run on every commit to catch issues early and maintain consistent code standards.

What is the android repository pattern and how does it work with LiveData and ViewModel?

android-java teaches the repository pattern as an abstraction layer that provides a clean interface to data sources, whether they're local databases (Room), remote APIs (Retrofit), or in-memory caches. The repository pattern works seamlessly with LiveData and ViewModel by exposing data as observable streams that automatically notify the UI when data changes. This architecture decouples your UI from data sources, making it easy to swap implementations, test in isolation, and handle complex data scenarios like offline-first synchronization while maintaining lifecycle awareness.

SKILL.md

rendered from the published skill — quoted content, verbatim

Android Java Skill


Project Structure

``` project/ ├── app/ │ ├── src/ │ │ ├── main/ │ │ │ ├── java/com/example/app/ │ │ │ │ ├── data/ # Data layer │ │ │ │ │ ├── local/ # Room database, SharedPreferences │ │ │ │ │ ├── remote/ # Retrofit services, API clients │ │ │ │ │ └── repository/ # Repository implementations │ │ │ │ ├── di/ # Dependency injection (Hilt/Dagger) │ │ │ │ ├── domain/ # Business logic │ │ │ │ │ ├── model/ # Domain models │ │ │ │ │ ├── repository/ # Repository interfaces │ │ │ │ │ └── usecase/ # Use cases │ │ │ │ ├── ui/ # Presentation layer │ │ │ │ │ ├── feature/ # Feature screens │ │ │ │ │ │ ├── FeatureActivity.java │ │ │ │ │ │ ├── FeatureFragment.java │ │ │ │ │ │ └── FeatureViewModel.java │

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
skills/android-java/SKILL.md

Related skills

Tags

clean-architecture ui-state-management data-persistence automated-testing build-automation memory-safety api-integration lifecycle-aware code-quality reactive-patterns