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
// 1 | |
Route::get('bb/(:any?)/(:num?)', function($p1 = 'zzzz', $p2 = 9999) | |
{ | |
return "$p1 $p2"; | |
}); | |
// 2 | |
Route::get('(:any?)/(:num?)', function($p1 = 'zzzz', $p2 = 9999) | |
{ | |
return "$p1 $p2"; |
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
Route::get('(:any)/(:num?)', function($p1 = 'zzzz', $p2 = 9999) | |
{ | |
return "$p1 $p2"; | |
}); |
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 intent = new Intent(); | |
intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); | |
intent.addCategory(Intent.CATEGORY_DEFAULT); | |
startActivityForResult(intent, 0); // ここの0の番号で呼び出し元と呼び出し先で対象かどうか判断する |
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
Bundle myExtras = getIntent().getExtras(); | |
if (myExtras != null) { | |
mSaveUri = (Uri) myExtras.getParcelable(MediaStore.EXTRA_OUTPUT); | |
mCropValue = myExtras.getString("crop"); | |
} |
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
if (mSaveUri != null) { | |
OutputStream outputStream = null; | |
try { | |
outputStream = mContentResolver.openOutputStream(mSaveUri); | |
outputStream.write(data); | |
outputStream.close(); | |
setResult(RESULT_OK); | |
finish(); | |
} catch (IOException ex) { |
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
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
if (requestCode == IMAGE_CAPTURE) { | |
Log.d(TAG, "onActivityResult"); | |
if (resultCode == RESULT_OK) { | |
Bundle bundle = data.getExtras(); | |
Bitmap bitmap = (Bitmap) bundle.getParcelable("data"); | |
ImageView imageView = (ImageView) findViewById(R.id.photo_image); | |
imageView.setImageBitmap(bitmap); | |
} |
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
mImageUri = getPhotoUri(); | |
Intent intent = new Intent(); | |
intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); | |
intent.addCategory(Intent.CATEGORY_DEFAULT); | |
intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageUri); | |
startActivityForResult(intent, IMAGE_CAPTURE); |
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
/** | |
* 画像のディレクトリパスを取得する | |
* | |
* @return | |
*/ | |
private String getDirPath() { | |
String dirPath = ""; | |
File photoDir = null; | |
File extStorageDir = Environment.getExternalStorageDirectory(); | |
if (extStorageDir.canWrite()) { |
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
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
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
ImageView imageView = (ImageView) findViewById(R.id.photo_image); | |
imageView.setImageURI(mImageUri); |