Time of Update: 2018-12-06
最近項目用到,記錄一下。 首先,讓j2ee那幫兄弟把服務端Hessian實現的介面類以及這個介面類公用方法所傳入、返回的那些需要序列化的類給自己,copy也行,打成jar包也行。 介面相關的類的包名和類名也必須得和服務端的相同。 剩下就是用戶端加入 hessdroid這個包了,android的一個第三方Hessian庫。 調用很簡單,下面是範例程式碼: HessianProxyFactory factory=new HessianProxyFactory();
Time of Update: 2018-12-06
package com.eboy.phone;import android.net.Uri;import android.os.Bundle;import android.app.Activity;import android.content.Intent;import android.view.View;import android.widget.Button;import android.widget.EditText;public class MainActivity extends Ac
Time of Update: 2018-12-06
因受系統限制,只能錄自已麥的聲音,錄不到對方的聲音,可能需要改核心才能實現雙向錄音;接通電話和掛斷電話時,震動一下;使用廣播接收者實現自啟動; 服務代碼: package com.eboy.phoneListener;import java.io.File;import android.app.Service;import android.content.Context;import android.content.Intent;import android.media.MediaRecord
Time of Update: 2018-12-06
<?xml version="1.0" encoding="UTF-8"?><persons> <person id="23"> <name>eboy</name> <age>22</age> </person> <person id="24"> <name>Frr</name> <ag
Time of Update: 2018-12-06
1.使用VedioView VideoView videoView = (VideoView)findViewById(R.id.video); String src = "rtsp://v6.cache7.c.youtube.com/CjYLENy73wIaLQlSNwWysTZuKRMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYP6mvvezrYeZTgw=/0/0/0/video.3gp";
Time of Update: 2018-12-06
參考網頁:http://www.njpro.cn/forum.php?mod=viewthread&tid=111http://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcphttp://forum.xda-developers.com/showthread.php?t=1071584 方法一:利用USB連接線進行串連1.
Time of Update: 2018-12-06
使用系統內建瀏覽器可以成功播放flash,可是利用自己開發的就無法播放。代碼如下:browser = (WebView) findViewById(R.id.webview);browser.getSettings().setJavaScriptEnabled(true);browser.getSettings().setPluginsEnabled(true);browser.getSettings().setAllowFileAccess(true);browser.getSettings(
Time of Update: 2018-12-06
一種是使用ScrollView和HorizontalScrollView結合。 這種方式的話,斜向滑動會有先後次序,一般將ScrollView放在外層第二種,使用onTouchEvent方法,監聽移動事件,進行處理。 如果只是監聽移動事件,圖片可以移出指定地區之外,可以通過控制邊界來進行限制在一定範圍內移動。 簡單解決方案代碼如下: container.setOnTouchListener(new OnTouchListener() { @
Time of Update: 2018-12-06
在之前處理過一個問題在任意視窗前彈出rss更新提醒對話方塊,如下頁面:http://www.cnblogs.com/sipher/articles/2502092.html利用上面的方法可以快顯視窗,不過沒有辦法在視窗中啟動一個activity。於是最近看有沒有其他辦法可以實現,想到在alertDialog中無法啟動,那就還是彈出一個activity類比視窗,再在其中啟動activity。代碼如下:private void showRssUpateRemindDialog() {
Time of Update: 2018-12-06
Android 介面編程有兩種基本的方法,一種是在代碼中,動態建立一個個組件,及把這些組件用Layout來進行組合成複雜的介面展現。一種是用圖形化的方式來編寫 布局Layout,這些布局被儲存在XML檔案中,會編譯成資源,被程式中的Activity來載入(setContentView()),
Time of Update: 2018-12-06
使用搭建好的Eclipse + ADT 環境。在Eclipse中選擇 File > New > Project 功能表項目。如果你已經成功安裝了Android 外掛程式,你會在彈出的新項目對話方塊中看到一個叫做“Android”的條目,包含一個”Android Project”的項目 選中"Android Project",點擊 Next進行入下一步。彈出一個項目屬性視窗,要填寫如下域:Project Name :這是電腦中儲存專案檔目錄的名稱。Package Name
Time of Update: 2018-12-06
在Android中,有對應於其它語言中的進度條,也就是我們要提到的ProgressDialog,但絕對美觀大方,可以產生一個ProgressDialog對象,設定彈出進度視窗的標題(setTitle),過程提示訊息(setMessage),再顯示(show)即可,也可直接調用ProgressDialog的showl靜態方法,直接顯示一個進度框,如果設定ProgressDialog為可以被Cancel的,則能通過手機回退鍵來中止它,否則只有通過程式內部的邏輯來中止,通過介面及鍵盤是無法
Time of Update: 2018-12-06
偶爾地,你可能想要確保你的應用程式在某一個確定的方向上面顯示,橫屏模式或豎屏模式。例如,你可能會開發一款只在橫屏模式下面啟動並執行遊戲。在這種情況下,可以通過編寫代碼,強制把Activity的方向設定為橫向,這需要使用Activity類的setRequestOrientation()方法。[java] view plaincopyimport android.content.pm.ActivityInfo; @Override public void onCreate(Bundle
Time of Update: 2018-12-06
//建立建立全域變數類 1 public class MyApplication extends Application { 2 3 /** 4 * 建立全域變數 5 * 全域變數一般都比較傾向於建立一個單獨的資料類檔案,並使用static靜態變數 6 * 7 * 這裡使用了在Application中添加資料的方法實現全域變數 8 * 注意在AndroidManifest.xml中的Application節點添加android
Time of Update: 2018-12-06
//能夠取得螢幕的資訊 DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm);dm.widthPixels; //取得寬像素 dm.heightPixels; //取得高像素 //擷取當地的日曆 Calendar c=Calendar.getInstance();
Time of Update: 2018-12-06
效果:有兩個Activity分別為A和B,從A中採用Bundle封裝資料向B中傳遞資料,然後使用startActivityForResult在B中修改後回傳資料。第一個Activity的layout如main.xml: 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3
Time of Update: 2018-12-06
結構繼承關係public interface IBinderandroid.os.IBinder子類及間接子類間接子類Binder一個遠程對象的基類,IBinder定義一個輕量級的遠端程序呼叫機制的核心部分。 類概述Base interface for a remotable object, the core part of a lightweight remote procedure call mechanism designed for high performance when
Time of Update: 2018-12-06
感應器的種類:1. 動作感應器加速度感應器、重力感應器和陀螺儀(判斷手機姿態)等2. 定位感應器方向感應器和磁力感應器3. 環境感應器溫度感應器 、壓力感應器和亮度感應器 使用感應器的方法:1. 擷取SensorManager對象 SensorManager sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); 2.
Time of Update: 2018-12-06
//獲得相應的系統服務 TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); //使用TelephonyManager對象的listen(PhoneStateListener listener, int
Time of Update: 2018-12-06
研究官方範例無疑是快速學習任何SDK的不二法門,Android內建samples檔案夾工程的建立可以參考這裡,下面是我在調試該工程時遇到的兩個問題,示:錯誤1WARNING: Application does not specify an API level requirement!解決方案:在Mainfest.xml檔案中的<mainfest ...></mainfest>元素中添加<uses-sdk android:minSdkVersion="10"