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 / 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 / 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 / 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:30
AndroidAnnotationsライブラリーを使ったHello World!
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yochiand.myexampleandroidannotations"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="3" />
<application
android:icon="@drawable/ic_launcher"
@sakurabird
sakurabird / AndroidManifest.xml
Created September 22, 2012 15:43
emailのリンクからアプリを起動するサンプル
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sakurafish.myexamplemaillink"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
@sakurabird
sakurabird / CommonDialogFragment.java
Created February 6, 2013 19:13
DialogFragmentでシンプルで汎用的なダイアログ
package sakura.example.myexamdialogfragment;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
public class CommonDialogFragment extends DialogFragment {
private DialogListener listener = null;
@sakurabird
sakurabird / ExpandableHeightGridView.java
Last active April 6, 2023 17:20
AndroidのScrollViewの中のGridViewのlayout_heightが伸び縮みしないのを独自Viewで克服
package xx.xxx.xx.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.GridView;
/**
* ScrollViewの中のGridViewでも高さを可変にする<br>
* http://stackoverflow.com/questions/8481844/gridview-height-gets-cut
@sakurabird
sakurabird / gist:6868909
Last active January 13, 2021 23:17
AndroidのScrollViewの中でもうまくGridViewのScrollを効かす
mGridView = (GridView) getView().findViewById(R.id.spotsView);
mGridView.setOnTouchListener(new GridView.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// ScrollViewの中でもうまくGridViewのScrollを効かす
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
v.getParent().requestDisallowInterceptTouchEvent(true);
break;
@sakurabird
sakurabird / RequestGPSDialogFragment.java
Created October 7, 2013 14:32
Androidのシステム位置情報をoffにしているユーザーに設定を促すダイアログ
package xxxxx.fragment;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
@sakurabird
sakurabird / gist:6869023
Last active December 24, 2015 21:58
Android 緯度経度から2点間の距離をメートルで返す
/**
* 緯度経度から2点間の距離をメートルで返す
*
* @param lat_a
* @param lng_a
* @param lat_b
* @param lng_b
* @return
*/
public static double getDistance(double lat_a, double lng_a, double lat_b, double lng_b) {