Skip to content

Instantly share code, notes, and snippets.

View loveprotocol's full-sized avatar

subs loveprotocol

View GitHub Profile
@loveprotocol
loveprotocol / LinkifySample.kt
Created May 13, 2021 06:35
Linkify Example
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var tags = ""
item.tagList.forEach {
tags += "#$it "
}
val tagTv = holder.viewBinding.fragPostingsItemTvTag
with(tagTv) {
text = tags
highlightColor = context.getColor(android.R.color.transparent)
@loveprotocol
loveprotocol / AddFragmentInActivity.xml
Created February 17, 2021 06:09
How to add fragment in Activity
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<fragment android:name="com.yes.no.possibleFragment"
var address : String = "" // Null 비허용
//대충 address를 얻어오는 코드 생략
...
if (address.length != 0) {
if (address.contain("seoul")) {
...
}
} else {
String address; // Java String 타입은 참조 타입이므로 Null 기본 허용
//대충 address를 얻어오는 코드 생략
...
if (address != null && address.length() != 0) {
if (address.contain("seoul")) {
...
}
} else {