View pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<configuration> | |
<source>1.6</source> | |
<target>1.6</target> | |
<encoding>UTF-8</encoding> | |
<!-- does not work. --> | |
<!-- | |
<compilerArguments> | |
<AandroidManifestFile>${project.basedir}/src/main/AndroidManifest.xml</AandroidManifestFile> |
View build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
apply plugin: 'android-apt' | |
apply plugin: 'android-power-assert' | |
group = 'net.granoeste' | |
version = '1.0.0' | |
def AAVersion = '3.0.1' | |
android { |
View gist:858063
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@android:id/tabhost" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
> | |
<RelativeLayout | |
android:layout_width="fill_parent" |
View gist:895848
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File dir = context.getFilesDir(); // /data/data/package/files | |
File dir = context.getCacheDir(); // /data/data/package/cache | |
File dir = Environment.getDataDirectory(); // /data | |
File dir = Environment.getDownloadCacheDirectory(); // /cache | |
File dir = Environment.getExternalStorageDirectory(); // /sdcard | |
File dir = Environment.getRootDirectory(); // /system |
View gist:895862
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final int REQUEST_CROP_GALLERY=1; | |
private File mTempFile; | |
public void onClick(View v) { | |
try { | |
mTempFile = getTempFile(); | |
// Launch picker to choose photo for selected contact | |
Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); |
View gist:982578
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final private Handler mHandler = new Handler() { | |
@Override | |
public void handleMessage(final Message msg) { | |
switch (msg.what) { | |
case MESSAGE_ONE: | |
// TODO: | |
return; | |
case MESSAGE_TWO: | |
// TODO: | |
return; |
View gist:1024384
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// copy from http://goo.gl/NxT8B | |
private LocationManager mLocationManager; | |
private String mBestProvider; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
// 位置情報サービスマネージャを取得 |
View gist:1026660
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a BroadcastReceiver for ACTION_FOUND and ACTION_DISCOVERY_FINISHED | |
private final BroadcastReceiver mDeviceDiscoverReceiver = new BroadcastReceiver() { | |
int cnt = 0; | |
public void onReceive(Context context, Intent intent) { | |
String action = intent.getAction(); | |
// When discovery finds a device | |
if (BluetoothDevice.ACTION_FOUND.equals(action)) { | |
// Get the BluetoothDevice object from the Intent | |
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); |
View To start the repeatedly running.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent serviceIntent = new Intent(this, MyService.class); | |
PendingIntent pendingIntent | |
= PendingIntent.getService(this, 0, serviceIntent, PendingIntent.FLAG_UPDATE_CURRENT); | |
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); | |
am.setInexactRepeating ( | |
AlarmManager.RTC, | |
System.currentTimeMillis(), | |
//AlarmManager.INTERVAL_HOUR, | |
AlarmManager.INTERVAL_FIFTEEN_MINUTES, | |
pendingIntent); |
OlderNewer