Skip to content

Instantly share code, notes, and snippets.

@mryp
mryp / SampleTimer.java
Created May 20, 2015 13:47
一定間隔で実行するタイマー処理
private ScheduledExecutorService m_clockService;
private ScheduledFuture m_clockFuture;
/**
* 一定間隔で実行するタイマーをセットする
* @param period タイマー時間(ミリ秒)
*/
private void initTimer(int period) {
if (m_clockService != null) {
return;
@mryp
mryp / SntpClient.java
Last active August 29, 2015 14:21
NTP時刻取得
/*
* Copyright (C) 2008 The Android Open Source Project
*
* 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
@mryp
mryp / AndroidManifest.xml
Created May 17, 2015 12:50
バイブレーション(Vibrator)
<uses-permission android:name="android.permission.VIBRATE" />
@mryp
mryp / SoundPlayer.java
Last active August 29, 2015 14:21
効果音再生(SoundPool)
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
public class SoundPlayer {
//フィールド
//-------------------------------------------------
private SoundPool m_soundPool; //音再生クラス
private int m_soundId; //再生音ID
private boolean m_isReady = false; //再生準備完了かどうか
@mryp
mryp / SampleAsyncTask.java
Last active August 29, 2015 14:21
非同期処理(AsyncTask)
import android.os.AsyncTask;
public class SampleAsyncTask extends AsyncTask<String, Integer, Integer> {
/**
* 前処理
*/
@Override
protected void onPreExecute() {
//開始前の初期化処理等を行う
}