Eros Live
          Find the Way
          posts - 15,comments - 0,trackbacks - 0
          <2010年7月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(1)

          隨筆檔案

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          在manifest的activity節(jié)點使用

          <activity android:windowSoftInputMode="adjustResize" . . . >

          當點擊EditText控件彈出軟鍵盤的時候,系統(tǒng)會自動調(diào)整控件的位置。

          代碼

          http://github.com/shaobin0604/miscandroidapps/tree/master/WindowSoftInputMode/

          參考

          posted @ 2010-08-25 18:42 Eros 閱讀(272) | 評論 (0)編輯 收藏

          AppWidget的初始化有兩種方式:

          1. 沒有提供Configure Activity, 則在 AppWidgetProvider#onUpdate 里初始化。
          2. 提供Configure Activity, 則在 Configure Activity 里初始化。

          目前遇到的問題是:

          在Launcher里可以預(yù)先配置桌面顯示的AppWidget,如果AppWidget有Configure Activity,則系統(tǒng)在AppWidget的初始化過程不會發(fā)送android.appwidget.action.APPWIDGET_CONFIGURE Intent,而只是加載appwidget-provider里配置的initialLayout。這樣第二種就不可用,只能用第一種方法。

          posted @ 2010-08-24 11:11 Eros 閱讀(432) | 評論 (0)編輯 收藏

          1.字體大小

          synchronized void
          setTextSize(WebSettings.TextSize t)

          Set the text size of the page.

          2.縮放比例

          void
          setSupportZoom(boolean support)

          Set whether the WebView supports zoom

          void
          setInitialScale(int scaleInPercent)

          Set the initial scale for the WebView.

          boolean
          zoomIn()

          Perform zoom in in the webview

          boolean
          zoomOut()

          Perform zoom out in the webview

          3.縮放控件

          void
          setBuiltInZoomControls(boolean enabled)

          Sets whether the zoom mechanism built into WebView is used.

          4.JavaScript支持

          synchronized void
          setJavaScriptEnabled(boolean flag)

          Tell the WebView to enable javascript execution.

          posted @ 2010-07-28 12:49 Eros 閱讀(390) | 評論 (0)編輯 收藏

          在程序里備份恢復(fù)數(shù)據(jù)

          public static boolean backupDatabase() {
              File dbFile = new File(Environment.getDataDirectory() + "/data/" + PKG + "/databases/" + DB_NAME);
           
              File exportDir = new File(Environment.getExternalStorageDirectory(), "pocket-voa");
              
              if (!exportDir.exists()) {
                  exportDir.mkdirs();
              }
              
              File file = new File(exportDir, dbFile.getName());
           
              try {
                  file.createNewFile();
                  copyFile(dbFile, file);
                  return true;
              } catch (IOException e) {
                  Log.e(TAG, "[backupDatabase] error", e);
                  return false;
              }
          }
           
          public static boolean restoreDatabase() {
              File dbFile = new File(Environment.getDataDirectory() + "/data/" + PKG + "/databases/" + DatabaseHelper.DB_NAME);
           
              File exportDbFile = new File(Environment.getExternalStorageDirectory() + "/pocket-voa/" + DatabaseHelper.DB_NAME);
              
              if (!exportDbFile.exists())
                  return false;
           
              try {
                  dbFile.createNewFile();
                  copyFile(exportDbFile, dbFile);
                  return true;
              } catch (IOException e) {
                  Log.e(TAG, "[restoreDatabase] error", e);
                  return false;
              }
          }
           
          private static void copyFile(File src, File dst) throws IOException {
              FileChannel inChannel = new FileInputStream(src).getChannel();
              FileChannel outChannel = new FileOutputStream(dst).getChannel();
              try {
                  inChannel.transferTo(0, inChannel.size(), outChannel);
              } finally {
                  if (inChannel != null)
                      inChannel.close();
                  if (outChannel != null)
                      outChannel.close();
              }
          }

          參考

          posted @ 2010-07-26 17:24 Eros 閱讀(345) | 評論 (0)編輯 收藏

           

          There are certain events that Android does not want to start up new processes for, so the device does not get too slow from all sorts of stuff all having to run at once. ACTION_SCREEN_ON is one of those. See this previous question for light blue advice on that topic.

          So, you need to ask yourself, "Self, do I really need to get control on those events?". The core Android team would like it if your answer was "no".

          posted @ 2010-07-22 19:59 Eros 閱讀(1178) | 評論 (0)編輯 收藏
               摘要: 1.海詞 http://api.dict.cn/ws.php?utf8=true&q=#{word} 返回格式XML<?xml version="1.0" encoding="UTF-8" ?> <dict> <key>word</key> <lang>ec</lang> <audio>...  閱讀全文
          posted @ 2010-07-15 15:45 Eros 閱讀(2038) | 評論 (0)編輯 收藏

          打開終端輸入

          adb devices

          出現(xiàn)如下內(nèi)容

          ??????????? no permissions

          原因是啟動adb的時候需要有root權(quán)限。如果一開始忘記加了sudo, 就必須先終止adb。

          $ adb kill-server

          $ sudo adb start-server

          $ adb devices

          就可以看到設(shè)備信息了。

          參考

          posted @ 2010-07-07 15:44 Eros 閱讀(597) | 評論 (0)編輯 收藏
               摘要: 原理 關(guān)閉APN的原理是在APN信息表(content://telephony/carriers/current)的apn, type字段添加自定義的后綴(參考自APNDroid) 代碼 (取自 Quick Settings) package com.android.settings.widget; import android.content.ContentResolver;impo...  閱讀全文
          posted @ 2010-07-07 15:28 Eros 閱讀(724) | 評論 (0)編輯 收藏

          環(huán)境

          Ubuntu 9.10 64bit, sun-jdk-1.5(因需要編譯Android源代碼), Android SDK 2.1

          癥狀

          draw9patch 不能正確顯示出窗口,沒有菜單欄

          原因

          sun jdk 1.5 的BUG

          解決

          安裝 sun jdk 1.6

          參考

          1. http://resources2.visual-paradigm.com/index.php/tips-support/53-support/61-blank-screen.html
          2. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6585673
          3. https://bugs.launchpad.net/ubuntu/+bug/164004
          4. http://forums.visual-paradigm.com/posts/list/6719.html
          posted @ 2010-07-07 12:19 Eros 閱讀(274) | 評論 (0)編輯 收藏
          主站蜘蛛池模板: 思茅市| 错那县| 毕节市| 金堂县| 屏东县| 彰武县| 禄丰县| 泰兴市| 石泉县| 利津县| 孟村| 桓仁| 哈尔滨市| 柳州市| 玉田县| 锡林郭勒盟| 宁陵县| 封开县| 宜君县| 泊头市| 南溪县| 宣威市| 高州市| 巴东县| 铅山县| 依安县| 绥中县| 玉树县| 攀枝花市| 鸡东县| 洛宁县| 扬州市| 神农架林区| 乌拉特前旗| 霍林郭勒市| 永城市| 湘阴县| 资阳市| 南雄市| 裕民县| 博爱县|