Skip to content

Instantly share code, notes, and snippets.

View khunzohn's full-sized avatar
🏠
Working from home

khunzohn khunzohn

🏠
Working from home
  • BandLab
  • Myanmar
View GitHub Profile
public class Utils {
public static String mapDigitToWord(int digit) throws DigitRangeException {
if(digit < 0 || digit > 9)
throw new DigitRangeException();
switch (digit) {
case 0: return "Zero";
case 1: return "One";
// case 2,3,...9
default: return "";
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_kotlin_extensions)
welcomeMessage.text = "Hello Kotlin!"
helloButton.setOnClickListener { toast.("Hello Kotlin") }
}
fun setMessaeg(message: String) {
welcomeMessage.text = message // this wont call findViewById again
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
@khunzohn
khunzohn / YearInnerAdapter.java
Created November 13, 2015 02:09
Inner RecyclerView Adapter
package com.hilllander.naunginlecalendar.util.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.hilllander.naunginlecalendar.R;
@khunzohn
khunzohn / YearMainAdapter.java
Created November 13, 2015 02:08
Outer RecyclerView adapter
package com.hilllander.naunginlecalendar.util.adapter;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@khunzohn
khunzohn / YearFragment.java
Created November 13, 2015 02:03
Nested RecyclerView within another RecyclerView used in generating calendar 's year grid view.
package com.hilllander.naunginlecalendar.view.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;