Wifi 一覧
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
protected void show_wifi_ssid() {
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifiManager.isWifiEnabled()) {
List<ScanResult> scanResults = wifiManager.getScanResults();
for (ScanResult x : scanResults) {
System.out.println("--------------------------------------------");
System.out.println(x.toString());
System.out.println(x.BSSID);
System.out.println(x.SSID);
System.out.println(x.capabilities);
}
} else {
Toast.makeText(this, "WifiNull", Toast.LENGTH_SHORT).show();
}
}
I/System.out: SSID: AirPort61998, BSSID: 34:76:c5:5e:f2:2e, capabilities: [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS], level: -87, frequency: 2432, timestamp: 413176363535, distance: ?(cm), distanceSd: ?(cm), wpsState :configured, wpsDeviceName :I-O DATA 802.11n AP Router
I/System.out: 34:76:c5:5e:f2:2e
I/System.out: AirPort61998
I/System.out: [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS]
2017年11月5日日曜日
2017年11月4日土曜日
Google 翻訳 の再生ファイルの保存の方法
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);
2017年10月15日日曜日
2017年8月30日水曜日
多言語化
多言語化
res/values/strings.xml - 英語
res/values-ja/strings.xml - 日本語
res/values-zh/strings.xml - 中国語(簡体)
res/values-zh-rTW/strings.xml - 中国語:台湾(繁體)
res/values-zh-rHK/strings.xml - 中国語:香港(繁體)
res/values-zh-rMO/strings.xml - 中国語:マカオ(繁體)
res/values-zh-rSG/strings.xml - 中国語:シンガポール(簡体)
res/values/strings.xml - 英語
res/values-ja/strings.xml - 日本語
res/values-zh/strings.xml - 中国語(簡体)
res/values-zh-rTW/strings.xml - 中国語:台湾(繁體)
res/values-zh-rHK/strings.xml - 中国語:香港(繁體)
res/values-zh-rMO/strings.xml - 中国語:マカオ(繁體)
res/values-zh-rSG/strings.xml - 中国語:シンガポール(簡体)
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);
}
登録:
投稿 (Atom)