Skip to content

Instantly share code, notes, and snippets.

@casidiablo
casidiablo / SimpleCursorLoader.java
Created September 14, 2011 20:03
Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview
/*
* Copyright 2012 CodeSlap - Cristian Castiblanco
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@gabu
gabu / gist:3309048
Created August 9, 2012 23:36
最近出るようになったLintの警告「This Handler classes should be static or leaks might occur.」を修正したHandlerがこちらになります。 元ネタ: http://stackoverflow.com/a/11408340
private Recipe114Handler mHander;
private static class Recipe114Handler extends Handler {
private final WeakReference<Recipe114Activity> mActivity;
public Recipe114Handler(Recipe114Activity activity) {
mActivity = new WeakReference<Recipe114Activity>(activity);
}
@Override
@yaraki
yaraki / ClockLiveData.kt
Last active December 21, 2019 07:02
This LiveData provides the time in hh:mm:ss format, updating the value every second
package io.github.yaraki.dependencyinjection
import android.arch.lifecycle.LiveData
import android.os.Handler
import android.os.Looper
import android.os.SystemClock
import android.text.format.DateFormat
import java.util.*
class ClockLiveData : LiveData<CharSequence>() {
@wshaddix
wshaddix / gist:8797934
Created February 4, 2014 03:57
Gets the week number for a given date
main () {
// get today's date
var now = new DateTime.now();
// set it to feb 10th for testing
//now = now.add(new Duration(days:7));
int today = now.weekday;
@NikolaDespotoski
NikolaDespotoski / BottomNavigationBehavior.java
Last active December 19, 2022 06:14
Bottom Navigation behavior
/*
* BottomNavigationLayout library for Android
* Copyright (c) 2016. Nikola Despotoski (http://github.com/NikolaDespotoski).
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@wtokuno
wtokuno / jackson.md
Created March 7, 2012 21:07
Jackson - JSON Processor

下書き

Jacksonとは

JacsonはJSON(JavaScript Object Notation)と呼ばれるデータ記述言語を扱うためのJavaライブラリ。

ウェブアプリケーション開発ではJSONが必須の技術になってきている。 JavaでJSONを扱うためのAPIがJava EE 7に含まれる予定。JSR 343として仕様策定中。

package net.yanzm.profileapplication;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
package net.yanzm.profileapplication;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.FragmentManager;
import android.content.Intent;
import android.net.Uri;
@nobuoka
nobuoka / java-for-android-app.markdown
Last active May 14, 2023 14:47
Android アプリ開発勉強会のために書いた Java の入門文書

Android アプリ開発のための Java 入門

MEMO

  • declaration は 「宣言」 と訳しているが、「定義」 の方が適しているような気がしなくもない。
  • 「インスタンス」 と 「オブジェクト」 という言葉を使うことがあるが、本文書中ではどちらも同じ意味で使用している。
  • String オブジェクト」 という表現は、「String クラスのインスタンス」 を意味している。 (Java に限らず一般的な表現だと思う。)

はじめに

import Foundation
extension String
{
var length: Int {
get {
return countElements(self)
}
}