Skip to content

Instantly share code, notes, and snippets.

View mkrupal09's full-sized avatar
🎯
Focusing

Krupal mkrupal09

🎯
Focusing
View GitHub Profile
Less Code : If you're developing app with traditinal approach you've to write too much code comparing to compose.
in imperative approach we've to create xml for layouts, declaring stying attributes,
extending custom classes - all this stuff eliminated using compose
Reusability : In imperative approach we
Multi screen : Compose works seaamlessly while working with multiple resolution screen as well foldable device using adaptive approach
Multi Platform : You can build multi platform app using compose. Rightnow it has Android, Desktop & Web support, still it's expanding with other platforms
Unistall software
sudo apt-get remove <application_name>
complete unistall
sudo apt-get purge <package-name>
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
package com.dc.retroapi.interceptor
import android.text.TextUtils
import android.util.Log
import com.dc.retroapi.annotations.RequestExclusionStrategy
import okhttp3.*
import okhttp3.ResponseBody.Companion.toResponseBody
package com.dc.retroapi.interceptor
import com.dc.retroapi.annotations.DataAsListResponse
import com.dc.retroapi.annotations.DataAsObjectResponse
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.ResponseBody.Companion.toResponseBody
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject

General rules for Development

MVVM

ViewModel

  • Don’t pass context in viewmodel because main purpose of viewmodel is seperating ui releated stuff

  • Clearing the resources like if you’re executing some background task then you’ve responisilibty to clear or dispose them to avoid memory leaks I.e if you’re using rx then clear disposables inside onCleared function if you’re using coroutines then use appropriate scope like viewmodel scope

@mkrupal09
mkrupal09 / Android libraries
Last active May 4, 2022 05:28
Android libraries
Audio Player
https://github.com/naman14/TimberX
Chat UI
https://github.com/stfalcon-studio/ChatKit
Inspect and modify what includes networks, databases, UIs, etc
https://github.com/whataa/pandora
// To combine list with other list
val list= arrayListOf("a1","a2","a3")
val list2= arrayListOf("b1","b2","b3")
list.zip(list2)
package com.dc.app
import android.app.ActivityManager
import android.content.Context
import android.content.Context.ACTIVITY_SERVICE
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager.EXTRA_LEVEL
import android.os.BatteryManager.EXTRA_SCALE
import android.os.Build
const val VOUCHER_TYPE = "voucher_type"
const val INVOICE_TYPE = "invoice_type"
const val VENDOR_TYPE = "vendor_type"
const val GENERAL_LEDGER_TYPE = "general_ledger_type"
const val BANK_BOOK_TYPE = "bankbook_type"
1.How many type of process in android?
- Foreground Process
- Visible Process
- Service Process
- Cached Process
https://developer.android.com/guide/components/activities/process-lifecycle
2.Activity lifecycle key loops
There are three key loops you may be interested in monitoring within your activity