Skip to content

Instantly share code, notes, and snippets.

View enginegl's full-sized avatar

Nikita Kozhemyakin enginegl

  • Limassol, Cyprus
View GitHub Profile
@enginegl
enginegl / gist:7ba16c7c61dcdd91cb171318dd0823a3
Created August 5, 2016 13:43 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(videoUrl));
intent.setDataAndType(Uri.parse(videoUrl), "video/*");
startActivity(intent);
private boolean handleBackStackFor(int identifier) {
String tag = new StringBuilder("fragment").append(identifier).toString();
FragmentManager fragmentManager = getFragmentManager();
int backStackEntryCount = fragmentManager.getBackStackEntryCount();
if (backStackEntryCount < 1) {
return false;
} else {
if (fragmentManager.getBackStackEntryAt(backStackEntryCount-1).getName().equals(tag)) {
return true;
} else {
package com.enginegl.mymaskededittext;
import android.content.Context;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;