Google 翻訳 の再生ファイルの保存の方法、手順の記録
1. Google Chrome ブラウザ翻訳文字を入れます。
2. F12 を押し、デバッグを開く
Application タプを開く → Frames →Media →
translate_tts をWクリックして開く 再生画面でダウンロードします。
2017年11月4日土曜日
2017年10月29日日曜日
SupportActionBar 背景色変更
SupportActionBar 背景色変更
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
int color = android.R.color.black;
Drawable backgroundDrawable = getApplicationContext().getResources().getDrawable(color);
actionBar.setBackgroundDrawable(backgroundDrawable);
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
int color = android.R.color.black;
Drawable backgroundDrawable = getApplicationContext().getResources().getDrawable(color);
actionBar.setBackgroundDrawable(backgroundDrawable);
2017年10月16日月曜日
assets フォルダ内の画像を読み込み
assets フォルダ内の画像を読み込み
AssetManager assetManager = getAssets();
ImageView imageView = (ImageView) findViewById(R.id.imageView);
InputStream inputStream = null;
try {
inputStream = assetManager.open("g1213.png");
} catch (IOException e) {
e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
imageView.setImageBitmap(bitmap);
AssetManager assetManager = getAssets();
ImageView imageView = (ImageView) findViewById(R.id.imageView);
InputStream inputStream = null;
try {
inputStream = assetManager.open("g1213.png");
} catch (IOException e) {
e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
imageView.setImageBitmap(bitmap);
ラベル:
Android
2017年10月15日日曜日
2017年8月30日水曜日
2017年8月28日月曜日
Android 通知音
Android 通知音
RingtoneManager
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == 999) {
Uri uri = (Uri) data.getExtras().get(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
Ringtone ringtone = RingtoneManager.getRingtone(getActivity(), uri);
String name = ringtone.getTitle(getActivity());
System.out.println(name);
System.out.println(uri);
set_sound_url(id, uri.toString());
TextView select_Sound = (TextView) view.findViewById(R.id.select_sound);
select_Sound.setText(get_sound_url_title(id));
}
}
protected void lin2(String id) {
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.select_sound_title));
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, false);
startActivityForResult(intent, 999);
}
RingtoneManager
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == 999) {
Uri uri = (Uri) data.getExtras().get(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
Ringtone ringtone = RingtoneManager.getRingtone(getActivity(), uri);
String name = ringtone.getTitle(getActivity());
System.out.println(name);
System.out.println(uri);
set_sound_url(id, uri.toString());
TextView select_Sound = (TextView) view.findViewById(R.id.select_sound);
select_Sound.setText(get_sound_url_title(id));
}
}
protected void lin2(String id) {
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.select_sound_title));
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, false);
startActivityForResult(intent, 999);
}
ラベル:
Android
2017年7月31日月曜日
Android SoundPool soundPool
public class MainActivity extends AppCompatActivity {
protected SoundPool soundPool;
protected int id;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
test();
AssetManager am = getAssets();
try {
id = soundPool.load(am.openFd("PCM-M10_441kHz16bit.wav"), 1);
} catch (IOException e) {
e.printStackTrace();
}
soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
@Override
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
Toast.makeText(MainActivity.this, "9999999999999", Toast.LENGTH_SHORT).show();
soundPool.play(id, 1, 1, 1, 1, 1);
}
});
}
protected void test() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
SoundPool.Builder spb = new SoundPool.Builder();
AudioAttributes.Builder b = new AudioAttributes.Builder();
b.setUsage(AudioAttributes.USAGE_MEDIA);
b.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC);
AudioAttributes a = b.build();
spb.setAudioAttributes(a);
spb.setMaxStreams(12);
soundPool = spb.build();
}
}
}
登録:
投稿 (Atom)