Skip to content

Instantly share code, notes, and snippets.

View kamydeep00178's full-sized avatar
🏠
Working from home

Coding Boost kamydeep00178

🏠
Working from home
  • Nagarro
  • Gurugram
View GitHub Profile
@kamydeep00178
kamydeep00178 / Categories
Created October 26, 2025 11:02
Categories
@Composable
fun Categories(){
Column(
modifier = Modifier.fillMaxSize()
.wrapContentSize(Alignment.Center)
) {
Text(text = "Categories",
fontSize = 18.sp,
color = androidx.compose.ui.graphics.Color.Gray,
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,
@kamydeep00178
kamydeep00178 / Home
Created October 26, 2025 11:01
Home
@Composable
fun Home(){
Column(
modifier = Modifier.fillMaxSize()
.wrapContentSize(Alignment.Center)
) {
Text(text = "Home",
fontSize = 18.sp,
color = Color.Gray,
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,
@kamydeep00178
kamydeep00178 / libraries
Last active October 26, 2025 11:00
libraries
[libraries]
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-navigation= { group = "androidx.navigation",name = "navigation-compose" }
@kamydeep00178
kamydeep00178 / ImageLoader
Created October 26, 2025 09:20
ImageLoader
ImageLoader.init(applicationContext)
@kamydeep00178
kamydeep00178 / CommonAnalytics
Created October 26, 2025 09:19
CommonAnalytics
CommonAnalytics.init(this) // ❌ from Activity
@kamydeep00178
kamydeep00178 / CommonAnalytics
Created October 26, 2025 09:19
CommonAnalytics
CommonAnalytics.init(applicationContext)
@kamydeep00178
kamydeep00178 / dialog
Created October 26, 2025 09:18
dialog
val dialog = AlertDialog.Builder(this).create()
dialog.show()
//if the Activity finishes, dialog still shown : (leaks)
@kamydeep00178
kamydeep00178 / myLiveData
Created October 26, 2025 09:17
myLiveData
myLiveData.observe(this){ data ->
// this refers to Activity
}
@kamydeep00178
kamydeep00178 / MyCustomView
Created October 26, 2025 09:16
MyCustomView
class MyCustomView(context: Context):View(context){
init {
Toast.makeText(context,"Hello Custom View",Toast.LENGTH_SHORT).show()
}
}
@kamydeep00178
kamydeep00178 / MySafeHandler
Created October 26, 2025 09:15
MySafeHandler
class MySafeHandler(activity: MyActivity) : Handler(Looper.getMainLooper()){
private val activityRef = WeakReference(activity)
override fun handleMessage(msg: Message){
activityRef.get()?.let { activityRef ->
// Safe to use
}
}
}