String directory = Environment.getExternalStorageDirectory().toString() + "/" + storeLocation + "/";
String s = getBucketId(directory);
Uri target = Uri.parse("content://media/external/images/media?bucketId=" + s);
Intent intent = new Intent(Intent.ACTION_VIEW, target);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if(Build.MODEL.contains("Nexus One")){
Intent in = new Intent();
in.setComponent(new ComponentName("com.cooliris.media","com.cooliris.media.Gallery"));
in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(in);
}else{
Boolean success = true;
try{
startActivity(intent);
}catch(ActivityNotFoundException anf){
Log.d(TAG, "onCreateOptionsMenu: cannot launch Gallery, trying to launch Hero specific Album");
success = false;
}
if(!success){
success = true;
try{
Intent intent_heroAlbum = new Intent();
intent_heroAlbum.setComponent(new ComponentName("com.htc.album","com.htc.album.AlbumTabSwitchActivity"));
intent_heroAlbum.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent_heroAlbum);
}catch(ActivityNotFoundException anf){
success = false;
Toast.makeText(TakePictureMain.this, "failed to launch Gallery", Toast.LENGTH_SHORT).show();
}
}
}