एक Activity ले user interface भएको एकल स्क्रिन प्रतिनिधित्व गर्छ — यो Android को एक मौलिक component हो। यसको lifecycle (यो सिर्जना, देखाइने, लुकाइने र नष्ट हुने क्रमको राज्य र callback हरुको अनुक्रम) संसाधन र अवस्था सही तरिकाले व्यवस्थापन गर्नको लागि समझ्न महत्वपूर्ण हो।
Activity के हो
An ACTIVITY = one screen of the app (a UI the user interacts with):
→ an app is typically several activities (a login screen, a home screen, etc.)
→ the OS manages activities and calls LIFECYCLE methods as their state changes
Activity lifecycle
Key lifecycle callbacks (the OS calls these as the activity's state changes):
onCreate() → activity is being CREATED → initialize UI, set up (called once)
onStart() → becoming VISIBLE to the user
onResume() → now in the FOREGROUND, interactive (user can interact)
onPause() → losing focus (another activity coming in front) → pause/save lightly
onStop() → no longer VISIBLE → release resources, stop heavy work
onDestroy() → being DESTROYED → final cleanup
→ Flow: onCreate → onStart → onResume → [running] → onPause → onStop → onDestroy
