Skip to content

Instantly share code, notes, and snippets.

View john-lorrenz's full-sized avatar
🏠
Working from home

John lorrenz Cruz john-lorrenz

🏠
Working from home
View GitHub Profile
@john-lorrenz
john-lorrenz / BitmapManipulation.kt
Last active November 13, 2019 09:51
Bitmap Manipulation
/*
Sample Parameter:
String: "file:///storage/emulated/0/Android/data/com.example.disappeardents/cache/roof_1.jpg"
*/
fun uriStringToBitmap(uriString : String) : Bitmap {
val uri = uriString.toUri()
val uriPath = uri.path
val bitmap = BitmapFactory.decodeFile(uriPath)
@john-lorrenz
john-lorrenz / CreateDialog.kt
Last active November 19, 2019 16:50
Create dialogs
fun createBasicAlertDialog(){
val builder = AlertDialog.Builder(this)
builder.setTitle("[DIALOG TITLE]")
builder.setMessage("[DIALOG MESSAGE]")
builder.setPositiveButton("[YES TEXT]") { dialog, which ->
// Action on click yes
}
builder.setCancelable(false)