This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Helpful Links | |
------ | |
- [Google Doc - Room Db Query](https://developer.android.com/reference/android/arch/persistence/room/Query) | |
- [Google Doc - Accessing data from Dao](https://developer.android.com/training/data-storage/room/accessing-data) | |
- [Android Room: Handling Relations Using LiveData](https://proandroiddev.com/android-room-handling-relations-using-livedata-2d892e40bd53) | |
- [SQLite on Android Made Simple: Room Persistence Library with a Touch of RxJava](https://android.jlelse.eu/sqlite-on-android-made-simple-room-persistence-library-with-a-touch-of-rxjava-55e8dc5301cf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package com.example. | |
import android.graphics.drawable.Drawable | |
import android.graphics.drawable.PictureDrawable | |
import android.widget.ImageView | |
import com.bumptech.glide.RequestBuilder | |
import com.bumptech.glide.load.DataSource | |
import com.bumptech.glide.load.engine.GlideException | |
import com.bumptech.glide.request.RequestListener | |
import com.bumptech.glide.request.target.ImageViewTarget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kotlin Basic: | |
1. Null safe operator (?) : | |
println(name?.toUpperCase()) // if upper case then print name in uppercase else print null. | |
in java : | |
if (name.toUppercase != null){ | |
print(name.toUpperCase()) | |
} else print("null") | |
2. Not null assert(!!): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Call printHashKey(this) method in onCreate method. | |
fun printHashKey(context: Context) { | |
try { | |
val info = | |
context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES) | |
for (signature in info.signatures) { | |
val md = MessageDigest.getInstance("SHA") | |
md.update(signature.toByteArray()) | |
val hashKey = String(Base64.encode(md.digest(), 0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Release hash key: | |
keytool -exportcert -alias alias_name -keystore keystore_path | openssl sha1 -binary | openssl base64 | |
playstore key hash : echo SHA_1_key | xxd -r -p | openssl base64 // here playstore Sha_1_key, get by playstore console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Customizing title of Alertdilaog. | |
val builder = AlertDialog.Builder(this, R.style.CustomAlertDialog) | |
val tvTitle= TextView(this) | |
tvTitle.text = "Title of Alert Dialog!" | |
tvTitle.textSize = this.resources.getDimension(R.dimen.snack_bar_text_size) | |
builder.setCustomTitle(tvTitle) | |
// Cuatom default button | |
<style name="CustomAlertDialog" parent="@android:style/Theme.Dialog"> // for white : Theme.AppCompat.Light.Dialog.Alert | |
<item name="android:textSize">@dimen/snack_bar_text_size</item> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var count = 0 | |
fun main(args: Array<String>) { | |
println("Enter string to Count Vowels: ") | |
val inputSt: String? = readLine()!! | |
// val inputSt: String? = "Hi this to check" | |
print(checkforVowel(inputSt, inputSt?.length)) | |
} | |
fun checkforVowel(inputSt: String?, length: Int?): Int { | |
if (length == 1){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dagger Dependency Injection | |
1. Setting Up Dagger: | |
app: build.gradle | |
apply plugin: 'kotlin-kapt' | |
ext { | |
dagger_version = '2.17' | |
auto_value_version = '1.6.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(new MaterialApp(home: SwitchApp())); | |
} | |
class SwitchApp extends StatefulWidget { | |
@override | |
_switch createState() => new _switch(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(new MaterialApp(home: SliderApp())); | |
} | |
class SliderApp extends StatefulWidget { | |
@override | |
_slider createState() => new _slider(); | |
} |