<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      732003684

      導航

      隨手記(1)

      /**
      檢測網絡狀態
      */
      private boolean isNetWorkAvaiable(){
      
      mConnMan = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
      NetWorkInfo info = mConnMan.getActiveNetWork();
      if(info==null){
      
          return false;
          }
      reurn info.isContected();
      }
      /***
      服務停掉自身
      **/
      stopSelf();
      /**
      輪詢的方式(handler)
      **/
      private Handler handler = new Handler(){
          public void handleMessage(Message msg){
              switch(msg.what){
              if(isRunning){
                  
                  Message msg = obtainMessage(LOOP);
                  sendMessagedelayed(msg,30*1000);
                      }
              
              }
          
          }
      
      }

       

      /***在androidmanifest.xml中注冊service時,有一個android:process屬性,如果這個屬性以"."開頭,則為此服務開啟一個 
      全局的獨立進程,如果以":"開頭則為此服務開啟一個為此應用私有的獨立進程
      */
      /**
      取得版本的名字
      **/
      public static String getVerSionName(){
          String versionName="";
          try{
      
              versionName = context.getPackageManager().getPackageInfo(context.getPackageName(),1
          )
          catch(PackageManager.NameNotFoundException e){
                  
              }
          }
      }
      public static <T> T toObject(String result, Class<T> clazz)
        {
          if ((clazz == null) || (StringUtil.isEmpty(result))) {
            return null;
          }
          try
          {
            Gson gson = new Gson();
            return gson.fromJson(result, clazz);
          } catch (Exception e) {
            Log.e("JSON 轉換異常!", e);
            try {
              return clazz.newInstance();
            } catch (IllegalAccessException e1) {
              Log.e("toObject IllegalAccessException 實例化異常", e1);
            } catch (InstantiationException e1) {
              Log.e("toObject IllegalAccessException 實例化異常", e1);
            }
          }
          return null;
        }
      
      public void releae(){
      
      if(this.request!=null){
      
      this.request.abort();
          }
      }

      /**
      上傳文件
      /****
      從對話框列表中移除dialog
      
      */
      private static HashMap<String,Dialog> dialogs = new HashMap();
      public static void dismissAlert(Context context){
          Dialog dialog = (Dialog)dialogs.get(context.toString());
          if(dialog != null&&dialog.isShowing()){
              dialog.dismiss();
              dialogs.remove(context.toString());
          }
      
      }
      
      
      /***
      根據uri下載安裝軟件
      */
      
      private void setUp(String httpUrl){
      
          Uri uri = Uri.parse(httpUrl);
          Intent intent = new Intent(Intent.ACTION_VIEW,httpUrl);
          startActivity();
      }

       


      **/
      public
      String uploadFile(String upUrl, String filePath) { String end = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; String fileName = filePath.substring(filePath.lastIndexOf("/") + 1); try { URL url = new URL(upUrl); HttpURLConnection con = (HttpURLConnection)url.openConnection(); con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestMethod("POST"); con.setRequestProperty("Connection", "Keep-Alive"); con.setRequestProperty("Charset", "UTF-8"); con.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); DataOutputStream ds = new DataOutputStream(con.getOutputStream()); ds.writeBytes(twoHyphens + boundary + end); ds.writeBytes("Content-Disposition: form-data; name=\"file\";filename=\"" + fileName + "\"" + end); ds.writeBytes(end); InputStream fStream = new FileInputStream(new File(filePath)); int bufferSize = 1024; byte[] buffer = new byte[bufferSize]; int length = -1; while ((length = fStream.read(buffer)) != -1) { ds.write(buffer, 0, length); } ds.writeBytes(end); ds.writeBytes(twoHyphens + boundary + twoHyphens + end); fStream.close(); ds.flush(); InputStream is = con.getInputStream(); StringBuffer b = new StringBuffer(); int ch; while ((ch = is.read()) != -1) { int ch; b.append((char)ch); } ds.close(); return b.toString(); } catch (Exception e) { e.printStackTrace(); }return ""; }
      /***
      將從網絡上獲得的輸入流進行解析
      **/
      
      public MenuEntity parse(InputStream stream){
          try{
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = factory.newDocumentBuilder();
          Element root = docuemnt.getDocumentElement();
          return traverse(root);
          }
          catch (Exception ex) {
                  ex.printStackTrace();
                  Log.e("解析xml異常,異常為:" + ex);
              }
      
              return null;
      
      }
      /****
      下載文件
      
      **/
      
      
      
      private void download(String url ,File file){
          FileOutputStream f = createOpustream(file);
          try{
              
              Inputstream in = download(url);
              if (in == null)
                      return;
                  int fix = 0;
      
                  byte[] buffer = new byte[1024];
                  int len = 0;
              while((len = in.read(buffer)>0)){
      
              f.write(buffer,0,len);
              fix +=  len;
              
              }
          
          }
          catch (MalformedURLException e) {
                  // e.printStackTrace();
                  Log.e(e.getMessage(), e);
                  deleteFile(file);
              } catch (IOException e) {
                  // e.printStackTrace();
                  Log.e(e.getMessage(), e);
                  deleteFile(file);
              } finally {
                  // Closes this stream.
                  StreamUtil.closeSilently(f);
                  if (conn != null) {
                      conn.disconnect();
                  }
              }
      
      }
      
      private FileOutputStream createOpustream(File file){
          try
          {
              FileOutputStream out = new FileOutputstream(file);
          }catch(Exception e){
              deleteFile(file);
          }
      
      }
      
      private void deleteFile(File file){
      
          if(file.exits()&&file!=null){
              file.delete();
          }
      }
      
      private Inputstream download(String url){
      
          try{
              URL u = new URL(url);
              conn = (HttpURLConnection)u.openConnection();
              conn.setRequestMethod("GET");
              conn.setDoOutput(true);
              conn.connect();
              return conn.getInputstream();
          }catch (MalformedURLException e) {
                  // e.printStackTrace();
                  Log.e(e.getMessage(), e);
              } catch (IOException e) {
                  // e.printStackTrace();
                  Log.e(e.getMessage(), e);
              }
              return null;
      }
      /***
      判斷網絡狀態
      */
      public static boolean is3g2g(Context context){
          ConnectivityManager connectvityManager = (ConnectivityManager)context
          .getSystemService("connectivity");
          NetWorkInfo info = connectivityManager.getActiveNetWorkInfo();
          return (activeNetInfo!=null&&activeNetInfo.getType()==0);
      }
      /**
      在onfling之中判斷是否左滑
      **/
      
      private boolean isScrollingLeft(MotionEvent e1,MotionEvent e2){
          if(e1 == null||e2 == null){
          return false;
          }
          return e2.getX()>e1.getX();
      
      }

       

      posted on 2013-04-09 10:16  732003684  閱讀(186)  評論(0)    收藏  舉報

      主站蜘蛛池模板: 久久国产成人高清精品亚洲| h无码精品3d动漫在线观看| 亚洲av激情一区二区三区| 青青青爽在线视频观看| 亚洲色最新高清AV网站| 成人污视频| 日本久久99成人网站| 黑人巨茎大战欧美白妇| 涩涩爱狼人亚洲一区在线| 亚洲国产成人久久综合三区| 97午夜理论电影影院| 亚洲av激情五月性综合| 另类 专区 欧美 制服| 欧美色欧美亚洲高清在线观看| 亚洲一级特黄大片在线播放| 国产人妻人伦精品1国产丝袜| 伊伊人成亚洲综合人网香| 亚洲日韩久热中文字幕| av中文字幕国产精品| 免费国产拍久久受拍久久| 久久免费看少妇免费观看| 精品熟女少妇免费久久| 亚洲人午夜精品射精日韩| 国产精品自在自线视频| 精品人妻中文无码av在线| 无码一区二区三区中文字幕| 亚洲熟妇自偷自拍另欧美| 久久国内精品自在自线91| 黑人大战欲求不满人妻| 丰满少妇在线观看网站| 8av国产精品爽爽ⅴa在线观看| 18禁无遮挡啪啪无码网站| 亚洲人成网站77777在线观看| 国产福利在线观看免费第一福利| 亚洲美女少妇偷拍萌白酱| 久久久www成人免费精品| 免费黄色大全一区二区三区| 福利网午夜视频一区二区| 国产精品一二三区久久狼| 亚洲人成小说网站色在线| 精品中文人妻在线不卡|