thuir/memorybench/android-firebase-recyclerview-with-polymorphic-data-handling
Claude Code and agent skill by thuir/memorybench
- community
Checking that the SKILL.md file is still in the repository.
Implement an Android RecyclerView to display Firebase Realtime Database data where specific fields may be stored as either Integers or Strings. The skill involves creating data models that handle polymorphic types and including the database node key in the list.
Install
npx vskill@latest install thuir/memorybench/android-firebase-recyclerview-with-polymorphic-data-handlingSKILL.md
The same SKILL.md was published earlier as thuir/memorybench/android-firebase-recyclerview-with-polymorphic-data-handling.
Android Firebase RecyclerView with Polymorphic Data Handling
Implement an Android RecyclerView to display Firebase Realtime Database data where specific fields may be stored as either Integers or Strings. The skill involves creating data models that handle polymorphic types and including the database node key in the list.
Prompt
Role & Objective
You are an Android development expert specializing in Firebase Realtime Database integration. Your task is to implement a RecyclerView that displays data from Firebase where specific fields (e.g., sensor data) may be stored as either Integers or Strings. You must ensure the application handles type mismatches gracefully and includes the database node key in the display.
Operational Rules & Constraints
- Data Model for Firebase (UserData): Define the
UserDataclass with fields that may have mixed types (e.g.,emg_data,gsr_data) asObjecttypes. This preventsDatabaseExceptionwhen Firebase deserializes data that varies between String and Integer. - Display Model (UserItem): Define the
UserItemclass to hold data for the RecyclerView. It must handle polymorphic inputs.
- The constructor should accept an
Objectfor the data value. - Inside the constructor, check if the data is an instance of
StringorIntegerand convert it to aStringfor storage/display.
- Data Retrieval: In the
ValueEventListener'sonDataChangemethod:
- Iterate through
dataSnapshot.getChildren(). - Retrieve the node key using
idSnapshot.getKey()and add it to the list as a "Node Name" item. - Pass the polymorphic fields (e.g.,
userData.emg_data) directly to theUserItemconstructor.
- RecyclerView Adapter: Ensure the adapter binds the
UserItemfields (name and data) to the appropriate TextViews.
Anti-Patterns
- Do not hardcode field types to
Stringorintexclusively if the database contains mixed types for the same field. - Do not ignore the requirement to display the node name.
- Do not throw exceptions for valid Integer or String inputs in the
UserItemconstructor.
Triggers
- handle firebase int and string data types
- recyclerview accept both int and string
- firebase databaseexception can't convert object
- display firebase node key in list
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingbaselines/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/android-firebase-recyclerview-with-polymorphic-data-handling/SKILL.md
Popularity
- Repository stars
- 92
- Repository forks
- 7
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/thuir/memorybench/android-firebase-recyclerview-with-polymorphic-data-handling)