Skip to content

Instantly share code, notes, and snippets.

View kojiokb's full-sized avatar

kojiokb

  • Japan
View GitHub Profile
@kojiokb
kojiokb / SplashActivity.java
Created June 3, 2012 09:56
スプラッシュ画面を表示する方法
public class SplashActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
@kojiokb
kojiokb / ImageCache.java
Created August 18, 2012 13:49
LruCacheの使い方
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
public final class ImageCache {
private static final int MEM_CACHE_SIZE = 1 * 1024 * 1024; // 1MB
private static LruCache<String, Bitmap> sLruCache;
static {
@kojiokb
kojiokb / MainActivity.java
Created August 22, 2012 11:19
ぐるぐるしない
public class MainActivity extends Activity {
ProgressDialog mProgressDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mProgressDialog = new ProgressDialog(this);
@kojiokb
kojiokb / ConnectivityReceiver.java
Created August 22, 2012 11:30
ネットワークの接続・切断を検知して処理を行う
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
public class ConnectivityReceiver extends BroadcastReceiver {
/*
@kojiokb
kojiokb / MainActivity.java
Created August 22, 2012 11:55
2.2のぐるぐるしない対策
public class MainActivity extends Activity {
ProgressDialog mProgressDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.button).setOnClickListener(new OnClickListener() {
@kojiokb
kojiokb / MainActivity.java
Created August 24, 2012 05:57
SSLルート証明書
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@kojiokb
kojiokb / gist:3461074
Created August 25, 2012 05:07
プリファレンス
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("key", "value");
editor.commit();
@kojiokb
kojiokb / gist:3474144
Created August 26, 2012 04:43
プリファレンスファイルの格納場所
/data/data/<パッケージ名>/shared_prefs/<パッケージ名>_preferences.xml
※PreferenceManager.getDefaultSharedPreferences()を使った場合
@kojiokb
kojiokb / FbDialog.java
Created August 26, 2012 06:19
Facebook SDK for Android ログインダイアログ Backキー対応
/*
* Copyright 2010 Facebook, Inc.
*
* 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
@kojiokb
kojiokb / MainActivity.java
Created August 27, 2012 04:46
SoundPoolの使い方
import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends Activity implements View.OnClickListener {
private SoundPool mSoundPool;