freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于android平臺的天氣預(yù)報軟件的設(shè)計與實現(xiàn)-閱讀頁

2025-07-13 01:00本頁面
  

【正文】 tionsMenu實現(xiàn)功能點排布。 //緩存天氣的文件 public static final String STORE_WEATHER=store_weather。 //當前Activity的根布局 private LinearLayout rootLayout。 //設(shè)置窗口特征,為不顯示標題 requestWindowFeature()。 setContentView()。 //實例化菜單加載器 mi = new MenuInflater(this)。 File file= new File(dirPath)。 //如果文件不存在說明是第一次動行 if(!()) { //設(shè)置默認的壁紙 editor = getSharedPreferences(WALLPAPER_FILE, MODE_PRIVATE).edit()。 ()。 } else { //設(shè)置壁紙為文件中保存的 SharedPreferences sp= getSharedPreferences(WALLPAPER_FILE, MODE_PRIVATE)。 } //得到保存的城市天氣 SharedPreferences sp = getSharedPreferences( ,MODE_PRIVATE)。 if( cityCode!= null amp。 ().length()!=0) { SharedPreferences shared = getSharedPreferences(STORE_WEATHER, MODE_PRIVATE)。 //得到天氣緩沖文件中的有效期 long vaildTime = (validTime, currentTime)。 else setWeatherSituation(cityCode)。 (isFirstRun, isFirstRun)。 } } Override //得到設(shè)置頁面的回退 protected void onActivityResult(int requestCode, int resultCode, Intent data) { //得到城市的編碼 SharedPreferences sp = getSharedPreferences(, MODE_PRIVATE)。 if(cityCode!=nullamp。().length()!=0) { if(data!=nullamp。(updateWeather, false)) { //從網(wǎng)上更新新的天氣 setWeatherSituation(cityCode)。 setWeatherSituation(shared)。 } } //添加菜單項 public boolean onCreateOptionsMenu(Menu menu) { //加載菜單資源,實例化菜單 (, menu)。 SubMenu subMenu = (2).getSubMenu()。 switch((wellpaper, )) { case : item = (0)。 break。 (true)。 case : item = (2)。 break。 (true)。 } return true。 //得到城市的編碼 SharedPreferences sp = getSharedPreferences(, MODE_PRIVATE)。 startActivityForResult(intent, 0)。 case : //得到設(shè)置的城市碼 String cityCode = (code, )。amp。 } break。 (wellpaper, )。 (true)。 case : ()。 ()。 break。 (wellpaper, )。 (true)。 case : ()。 ()。 break。 } return true。// String info = +cityCode+.html。 info=new WebAccessTools(this).getWebContent(info)。在這里用ListView設(shè)置出城市的列表和設(shè)置自動定位的Adapter適配器,用Handler進行傳遞信息,簡單解釋一下Handler,Handler可以分發(fā)Message對象和Runnable對象到主線程中,每個Handler實例,都會綁定到創(chuàng)建他的線程中(一般是位于主線程)。在數(shù)據(jù)庫中取出城市編碼。/** * 一個設(shè)置城市的Activity */public class SetCityActivity extends Activity { private TextView localeCity。 // 定義的一個省份可伸縮性的列表 private ExpandableListView provinceList。 // 定義的一個記錄城市碼的SharedPreferences文件名 public static final String CITY_CODE_FILE = city_code。 // 省份 private String[] groups。 // 自定義的伸縮列表適配器 private MyListAdapter adapter。 Override public void onCreate(Bundle savedInstanceState) { (savedInstanceState)。 gpsView = (ListView) findViewById()。 // 設(shè)置自動定位的適配器 (new GPSListAdapter())。 HandlTask task = new HandlTask()。 (locationManager)。 (childs)。 Message message = new Message()。 (message)。 } })。 (new TextWatcher() { Override public void afterTextChanged(Editable s) { CharSequence filterContent = ()。 } Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } Override public void onTextChanged(CharSequence s, int start, int before, int count) { } })。 // 通過判斷MainActivity傳過來的isFirstRun來確定是否為第一次運行 boolean isFirstRun = (isFirstRun, false)。 if (extras != null) { mAppWidgetId = (, )。 if ((code, null) == null) { // 如果不存在城市碼,則說明為第一次運行 isFirstRun = true。 RemoteViews views = new RemoteViews( (), )。 if (cityCode != null amp。 ().length() 0) { (widget, ========update weather========)。 } (mAppWidgetId, views)。 (, mAppWidgetId)。 // 結(jié)束當前的Activity finish()。 } } } // 如果為true說明是第一次運行 if (isFirstRun) { // 導(dǎo)入城市編碼數(shù)據(jù)庫 importInitDatabase()。 (由于本程序是第一次運行,請選擇您需要了解天氣的城市).setPositiveButton( 確定, null)。 ()。 ()。 new Thread(new Runnable() { Override public void run() { // TODO Autogenerated method stub DBHelper dbHelper = new DBHelper(,)。 ListString[][] result = (groups)。 cityCodes = (1)。 = 。 ()。 } }).start()。 // 在伸縮性的列表中顯示數(shù)據(jù)庫中的省份與城市 adapter = new MyListAdapter(, provinceList, groups, childs)。 // 為其子列表選項添加單擊事件 (new OnChildClickListener() { Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // 自動跳至天氣的顯示界面MainActivity // ========得到單擊的城市碼======= // 得到城市名 String cityName = (String) (groupPosition, childPosition)。 String cityCode = (cityName)。 ()。 ()。 } })。 File dir = new File(dirPath)。 } // 數(shù)據(jù)庫文件 File dbfile = new File(dir, )。 } // 加載欲導(dǎo)入的數(shù)據(jù)庫 InputStream is = ().getResources() .openRawResource()。 byte[] buffere = new byte[()]。 (buffere)。 ()。 } catch (IOException e) { ()。 // 可以不顯示標題 (title)。 (content)。 return dialog。 // 得到訪問網(wǎng)絡(luò)的內(nèi)容 String webContent = webTools .getWebContent()。 String[] groups = new String[]。 String[][] cityCode = new String[][]。 i 。 // 由省份碼來得到城市碼 StringBuffer urlBuilder = new StringBuffer( )。 (.xml)。 String[][] citys = (webContent)。 // 計算總的城鎮(zhèn)數(shù) int sum = 0。 j 。 (citys[j][0])。 webContent = (())。 sum = sum + towns[j].length。 cityCode[i] = new String[sum]。 for (int j = 0。 j++) { for (int n = 0。 n++) { if (n == 0) childs[i][sum] = towns[j][n][1]。 urlBuilder = new StringBuffer( )。 (.xml)。 String[][] code = (webContent)。 sum = sum + 1。 } BaseExpandableListAdapter adapter = new MyListAdapter(this, provinceList, groups, childs)。 // 打開或創(chuàng)建一個數(shù)據(jù)庫 String path = /data + ().getAbsolutePath() + /。 // 創(chuàng)建一個省份表 String sql = create table provinces (_id integer primary key autoincrement, name text
點擊復(fù)制文檔內(nèi)容
職業(yè)教育相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1