Sobes.tech
Intern

What is your knowledge and experience with Core Android?

sobes.tech AI

Answer from AI

Knowledge and experience with Core Android encompass understanding the basic OS components and their interaction with applications.

My experience includes:

  • Activity and Fragment lifecycle: Deep understanding of lifecycle methods (onCreate, onStart, onResume, onPause, onStop, onDestroy) and managing states during screen rotations, app switching, and activity termination.
  • Intents and IPC: Using explicit and implicit intents to launch components (Activity, Service, BroadcastReceiver), transfer data, and inter-process communication (IPC).
  • Services: Creating and managing background tasks with Service, IntentService (deprecated but understood), and WorkManager for persistent background operations.
  • Broadcast Receivers: Registering and handling system and user broadcast messages.
  • Content Providers: Interacting with system and user databases, accessing shared data (e.g., contacts, media).
  • Threads and Concurrency: Working with threads, AsyncTask (deprecated), Handler, Looper, and modern tools like Coroutines for managing asynchronous operations.

Example of Activity lifecycle handling:

// Activity.kt
class MyActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_my)
        // Initialize UI, restore state from savedInstanceState
    }

    override fun onStart() {
        super.onStart()
        // Activity becomes visible
    }

    override fun onResume() {
        super.onResume()
        // Activity comes to foreground, user interaction possible
    }

    override fun onPause() {
        super.onPause()
        // Activity goes to background but still visible (e.g., dialog overlay)
    }

    override fun onStop() {
        super.onStop()
        // Activity is no longer visible
    }

    override fun onDestroy() {
        super.onDestroy()
        // Activity is destroyed
    }

    override fun onSaveInstanceState(outState: Bundle) {
        super.onSaveInstanceState(outState)
        // Save state before Activity destruction (e.g., on rotation)
        outState.putString("my_data", "some_value")
    }

    override fun onRestoreInstanceState(savedInstanceState: Bundle) {
        super.onRestoreInstanceState(savedInstanceState)
        // Restore state
        val data = savedInstanceState.getString("my_data")
        // Use restored data
    }
}

Understanding these fundamentals is critically important for creating stable and efficient Android applications.