Search

Activities & Fragments

An Activity represents a single screen in an Android app. Every activity goes through a well-defined lifecycle that helps Android manage memory and resources efficiently.

Key lifecycle states
🔸 onCreate() – Called when the activity is first created; initialize UI and data
🔸 onStart() – Activity becomes visible to the user
🔸 onResume() – Activity is in the foreground and user can interact
🔸 onPause() – Activity partially hidden; pause animations or save small data
🔸 onStop() – Activity no longer visible
🔸 onDestroy() – Activity is destroyed; clean up resources

Why lifecycle matters
🔸 Prevents memory leaks
🔸 Helps save and restore user data
🔸 Ensures smooth app performance


Intents (Explicit & Implicit)

An Intent is a messaging object used to request an action from another app component.

Explicit Intent
🔸 Used to start a specific activity within your app
🔸 You clearly mention the target class
🔸 Commonly used for internal navigation

Implicit Intent
🔸 Does not specify the target component
🔸 Android decides which app can handle the request
🔸 Used for actions like opening a browser, camera, or sharing content

Why intents are important
🔸 Enable communication between app components
🔸 Allow interaction with other apps
🔸 Support modular and flexible app design


Fragments & Fragment Manager

A Fragment is a reusable portion of UI inside an activity. One activity can host multiple fragments.

Fragments
🔸 Have their own lifecycle
🔸 Can be added, removed, or replaced dynamically
🔸 Improve UI flexibility for different screen sizes

Fragment Manager
🔸 Manages fragment transactions
🔸 Handles add, replace, remove operations
🔸 Maintains fragment back stack for navigation

Advantages of fragments
🔸 Better tablet and multi-pane layouts
🔸 Cleaner and reusable UI components
🔸 Easier UI updates without restarting activities


Bottom Navigation

Bottom Navigation allows switching between top-level views using tabs at the bottom of the screen.

Key features
🔸 Displays 3–5 primary destinations
🔸 Each tab represents an independent screen
🔸 Works best with fragments

When to use
🔸 Apps with multiple main sections
🔸 Quick and intuitive navigation
🔸 Modern material design apps


ViewPager

ViewPager allows users to swipe left or right between different screens or fragments.

Main concepts
🔸 Uses fragments as pages
🔸 Supports swipe gestures
🔸 Often combined with TabLayout

Common use cases
🔸 Intro/onboarding screens
🔸 Image sliders
🔸 Tab-based navigation

Benefits
🔸 Smooth user experience
🔸 Gesture-based navigation
🔸 Clean separation of content

Become a member

Get the latest news right in your inbox. We never spam!

Welcome to Skill to Growth - technology-focused learning blog, created for developers who want to build strong, real-world skills and grow confidently in their careers. I started this blog with one clear mission: to make learning technology simple, practical, and career-oriented for anyone who truly wants to grow. In a world full of scattered tutorials and half-explained concepts, this platform is built to give you clarity, structure, and confidence. This blog covers Android development, Flutter, React Native, Spring Boot, DevOps, and Git, designed carefully from absolute beginner to industry-ready level. Every topic here is written with the mindset of real-world application, not just theory. I believe that learning should not feel confusing or intimidating. That’s why each article focuses on strong fundamentals, clean explanations, and step-by-step learning paths that actually make sense. If you are a student starting from zero, this blog helps you build a solid foundation. If you are a working professional, it helps you upgrade your skills, stay relevant, and move ahead in your career. You’ll learn how to build mobile applications, create powerful backend systems, manage code using Git, and deploy applications using modern DevOps practices. More importantly, you’ll understand how everything connects, so you think like a complete developer—not just a coder. This platform is for those who are serious about their growth, who want more than just copy-paste tutorials. It’s for learners who want confidence in interviews, clarity in projects, and stability in their careers. Technology changes fast, but strong fundamentals and the right mindset never go out of date. This blog exists to help you build both. If you’re ready to invest in yourself, stay consistent, and learn the right way— you’re in the right place.
Comments
Leave a Comment

Login OR Register to write comments