Skip to content

Instantly share code, notes, and snippets.

View LinkifySample.kt
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 Feb 17, 2021
How to add fragment in Activity
View AddFragmentInActivity.xml
<?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"
View kotlinNullSafety_ktcode.kt
var address : String = "" // Null 비허용
//대충 address를 얻어오는 코드 생략
...
if (address.length != 0) {
if (address.contain("seoul")) {
...
}
} else {
View KotlinNullSafety_javacode.java
String address; // Java String 타입은 참조 타입이므로 Null 기본 허용
//대충 address를 얻어오는 코드 생략
...
if (address != null && address.length() != 0) {
if (address.contain("seoul")) {
...
}
} else {