WEB开发网
开发学院手机开发Android 开发 Android系列只androidGooglemap小应用 阅读

Android系列只androidGooglemap小应用

 2010-08-19 14:32:00 来源:WEB开发网   
核心提示:StringBuffer();24 FileInputStream fis = context.openFileInput(fileName);25 do{26 read = fis.read(buffer);27 if(read>0)28 stringbuffer.append(new String(buffe
StringBuffer();24 FileInputStream fis = context.openFileInput(fileName);25 do{26 read = fis.read(buffer);27 if(read>0)28 stringbuffer.append(new String(buffer, 0, read, "utf-8"));29 30 }while(read!=-1);31 fis.close();32 return stringbuffer.toString();33 }catch(Exception e){34 return null;35 }36 37 }

数据存储部分完毕了。接下来是关于切换手机情景的功能

手机的铃音设置

1 AudioManager audio = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); 2 3 // 铃声和震动 4 protected void ringAndVibrate(AudioManager audio){ 5 audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL); 6 audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON); 7 audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON); 8 } 9 // 铃声10 protected void ring(AudioManager audio){11 audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);12 audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);13 audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_OFF);14 }15 // 震动16 protected void vibrate(AudioManager audio){17 audio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);18 audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);19 audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON);20 }21 // 静音22 protected void silent(AudioManager audio){23 audio.setRingerMode(AudioManager.RINGER_MODE_SILENT);24 audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);25 audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_OFF);26 }27 // 改变声音-----减小28 protected void lowerVoice(AudioManager audio, int voice){29 audio.setRingerMode(AudioManager.ADJUST_LOWER);30 audio.adjustVolume(AudioManager.ADJUST_LOWER, voice);31 }32 // 改变声音-----增加33

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:Android 系列 androidGooglemap

编辑录入:coldstar [复制链接] [打 印]
赞助商链接