This file contains hidden or 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
<application | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" > | |
<activity | |
android:name="CustomActionBarActivity" | |
android:label="@string/title_activity_custom_actionbar" | |
android:theme="@style/Theme.Custom" /> | |
</application> |
This file contains hidden or 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
public class MainActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
findViewById(R.id.execute).setOnClickListener(new OnClickListener() { | |
@Override | |
public void onClick(View v) { |
This file contains hidden or 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"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="daichan4649.volley" | |
android:versionCode="1" | |
android:versionName="1.0" > | |
<uses-sdk | |
android:minSdkVersion="8" | |
android:targetSdkVersion="15" /> |
This file contains hidden or 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 TestTask mTask = null; | |
@Override | |
public void onResume() { | |
super.onResume(); | |
if (mTask != null) { | |
Status taskStatus = mTask.getStatus(); | |
if (taskStatus == AsyncTask.Status.RUNNING) { | |
// task is running |
This file contains hidden or 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
public static boolean isAvailableFileName(String fileName) { | |
if (TextUtils.isEmpty(fileName)) { | |
return false; | |
} | |
// 次の9文字は使用不可(< > : * ? " / \ |) | |
final String regularExpression = "^.*[(<|>|:|\\*|?|\"|/|\\\\|\\|)].*$"; | |
return !fileName.matches(regularExpression); | |
} |
This file contains hidden or 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
/** 有効サイズ(10MB) */ | |
private static final long AVAILABLE_DISK_SIZE = 10 * 1024 * 1024; | |
public static boolean isDiskAvailable() { | |
return isDiskAvailable(AVAILABLE_DISK_SIZE); | |
} | |
public static boolean isDiskAvailable(long limitSize) { | |
long diskAvailableSize = getDiskAvailableBytes(); | |
return diskAvailableSize > limitSize; |
This file contains hidden or 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
/** | |
* 入力フィルタ(半角英数) | |
* @see <a href="http://y-anz-m.blogspot.jp/2010/10/androidfilter.html">半角英数フィルタ</a> | |
*/ | |
class AlphaNumericFilter implements InputFilter { | |
@Override | |
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { | |
if (source.toString().matches("^[a-zA-Z0-9]+$")) { | |
return source; | |
} else { |
This file contains hidden or 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
adb shell cat /data/data/[packagename]/databases/[dbファイル名] > c:\tmp\data.db |
This file contains hidden or 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 static final String ALGORITHM_SHA1 = "SHA1"; | |
private static final String SALT = "saltvalue"; | |
public static String encode2SHA1Text(String plainText) { | |
return encode2SHA1Text(plainText, ALGORITHM_SHA1, SALT); | |
} | |
public static String encode2SHA1Text(String plainText, String algorithm, String salt) throws NoSuchAlgorithmException { | |
MessageDigest md = MessageDigest.getInstance(algorithm); |
This file contains hidden or 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
// FragmentA (in Activity A) | |
private void showActivityB(int requestCode) { | |
Intent intent = new Intent(getActivity(), ActivityB.class); | |
startActivityForResult(intent, requestCode); | |
} | |
@Override | |
public void onActivityResult(int requestCode, int resultCode, Intent data) { | |
if (resultCode != Activity.RESULT_OK) { | |
return; |