Skip to content

Instantly share code, notes, and snippets.

View sakurabird's full-sized avatar
💭
I may be slow to respond.

Yukari Sakurai sakurabird

💭
I may be slow to respond.
View GitHub Profile
@sakurabird
sakurabird / AndroidManifest.xml
Created July 10, 2012 14:15
マッシュルームアプリアプリを起動する/される
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sakurafish.example.myexamplemashreceive"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/ic_launcher"
@sakurabird
sakurabird / AndroidManifest.xml
Created July 10, 2012 14:04
イメージを選択する。Intent.ACTION_PICKとIntent.ACTION_GET_CONTENTの違いを比較する
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sakurafish.android.example.myexamplechooseimage"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/ic_launcher"
@sakurabird
sakurabird / MainActivity.java
Created June 3, 2012 08:11
ダイアログの上にListViewを表示してクリックした場所をToastで表示する
package com.sakurafish.android.example.myexamplelistondialog;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
@sakurabird
sakurabird / gist:1309074
Created October 24, 2011 13:52
Untouchable manifest
<?xmlversion="1.0"encoding="utf-8"?>
<manifestxmlns:android="http://schemas.android.com/apk/res/android"
package="com.yochiyochi.android.UntouchableTimer" ←Javaパッケージ名、世界でたった一つであること。
android:versionCode="6" ← マーケットにアップデートするたびにカウントアップするべき数
android:versionName="1.0" ← アプリのバージョン(ここは自分で決める)
android:installLocation="preferExternal" > ← インストールする場所(SDカード優先)
<uses-sdkandroid:minSdkVersion="8"/> ← ターゲットのバージョンこれ以下の機種にはインストール出来ない
<uses-permissionandroid:name="android.permission.RECORD_AUDIO"/> ← 音声認識を使用する権限を与える。
@sakurabird
sakurabird / gist:1309058
Created October 24, 2011 13:43
Untouchable アラーム音量
//インスタンス変数を宣言
AudioManager am;
SeekBar ringVolSeekBar;
TextView ringVolText;
// アラーム音量
am = ( AudioManager ) getSystemService( Context.AUDIO_SERVICE );
//現在の音量を取得します
int ringVolume = am.getStreamVolume( AudioManager.STREAM_MUSIC ); // 音量の取得
@sakurabird
sakurabird / gist:1309053
Created October 24, 2011 13:40
Untouchable プリファレンスアクティビティ java
public class SettingActivity extends PreferenceActivity {
@Override
publicvoid onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
// XML で Preference を設定
addPreferencesFromResource( R.xml.preference );
}
@sakurabird
sakurabird / gist:1309044
Created October 24, 2011 13:36
Untouchable プリファレンスアクティビティ xmlの定義
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/pref_cattitle_sound">
<ListPreference
android:title="@string/pref_title_sound"
android:summary="@string/pref_summary_sound"
android:key="@string/pref_key_sound"
android:entries="@array/entries"
android:entryValues="@array/entryValues"
android:dialogTitle="@string/pref_title_sound"
@sakurabird
sakurabird / gist:1309032
Created October 24, 2011 13:32
Untouchable プリファレンス
/***
* プリファレンスの値を読み込む
*
*/
privatevoid loadSetting() {
//自分で定義したプリファレンスファイルを使用することも出来ますが、デフォルトのプリファレンスを利用しています
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences( this );
// アプリのバージョン情報
@sakurabird
sakurabird / gist:1309022
Created October 24, 2011 13:27
Untouchable メニュー
//inflaterを使ってxmlリソースファイルを読み込んでメニューを作成する。
@Override
publicboolean onCreateOptionsMenu( Menu menu ) {
super.onCreateOptionsMenu( menu );
MenuInflater inflater = getMenuInflater();
//インフレートしています
inflater.inflate( R.menu.option_menu, menu );
returntrue;
}
@sakurabird
sakurabird / gist:1309018
Created October 24, 2011 13:24
Untouchable メニュー xml
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:title="@string/menu_title_setting"
android:id="@+id/menu_setting"
android:orderInCategory="1"
android:icon="@android:drawable/ic_menu_preferences"></item>
<item
android:title="@string/menu_title_help"