Skip to main content

Posts

Showing posts from July, 2022

Jetpack Compose with remember and mutableStateOf

  Jetpack Compose is a modern declarative UI Toolkit . In jetpack's declarative approach widgets are stateless and does not expose getter or setter function . So we cannot update UI with button.setText(String) or img.setImageBitmap()....  In Compose we build UI by defining set of Composable function. Composable function take in data and emit UI elements. So in Compose  only way to  update the UI is by calling the same Composable function with new Arguments. This Argument represents UI State. State in an app is any value that changes over time , this includes simple class variable to Room Database.  Any time a State is updated we need to call the Composable with new State to update the UI. This is called ReComposition .  This Demo Jetpack Compose app will help you understand the basics of Jetpack Compose. Screenshots of this App   This is our MainActivity package com.arun.androidtutsforu.democompose import android.os.Bundle import androidx.activity.ComponentActivity import androidx