安卓application中声明了一个SOCKET全局变量,我在一个activity给socket赋值了,为什么socket没改变?
android \u521b\u5efasocket \u8fde\u63a5\u540e\u628a socket\u5b58\u653e\u5230\u5168\u5c40\u53d8\u91cf\u3002\u540e\u9762\u518d\u901a\u8fc7socket\u7528static\u58f0\u660e\u6210\u5168\u5c40\u53d8\u91cf\u5373\u53ef\uff0c\u4f46\u662f\u4e0d\u5efa\u8bae\u8fd9\u4e48\u505a\uff0c\u5efa\u8bae\u4f7f\u7528Http\u534f\u8bae\u4e0e\u670d\u52a1\u5668\u901a\u4fe1\u3002Android\u96c6\u6210\u4e86Httpclient\u6846\u67b6\uff0c\u5c31\u662f\u7528Http\u4e0e\u670d\u52a1\u5668\u901a\u4fe1\u7528\u7684\u3002
\u53ef\u4ee5\u5c06\u53d8\u91cf\u5b58\u653e\u5728Application\u4e2d\uff0cContext\uff0c\u4e2d\u6587\u76f4\u8bd1\u4e3a\u201c\u4e0a\u4e0b\u6587\u201d\uff0cSDK\u4e2d\u5bf9\u5176\u8bf4\u660e\u5982\u4e0b\uff1a
Interface to global information about an application environment. This is an abstract class whose implementation
is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls
for application-level operations such as launching activities, broadcasting and receiving intents, etc\u3002
\u4ece\u4e0a\u53ef\u77e5\u4e00\u4e0b\u4e09\u70b9\u5373\uff1a
1\u3001\u5b83\u63cf\u8ff0\u7684\u662f\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u73af\u5883\u7684\u4fe1\u606f\uff0c\u5373\u4e0a\u4e0b\u6587\u3002
2\u3001\u8be5\u7c7b\u662f\u4e00\u4e2a\u62bd\u8c61(abstract class)\u7c7b\uff0cAndroid\u63d0\u4f9b\u4e86\u8be5\u62bd\u8c61\u7c7b\u7684\u5177\u4f53\u5b9e\u73b0\u7c7b(\u540e\u9762\u6211\u4eec\u4f1a\u8bb2\u5230\u662fContextIml\u7c7b)\u3002
3\u3001\u901a\u8fc7\u5b83\u6211\u4eec\u53ef\u4ee5\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u7684\u8d44\u6e90\u548c\u7c7b\uff0c\u4e5f\u5305\u62ec\u4e00\u4e9b\u5e94\u7528\u7ea7\u522b\u64cd\u4f5c\uff0c\u4f8b\u5982\uff1a\u542f\u52a8\u4e00\u4e2aActivity\uff0c\u53d1\u9001\u5e7f\u64ad\uff0c\u63a5\u53d7Intent\u4fe1\u606f\u7b49\u3002
\u4ee5\u4e0b\u4e3a\u4f7f\u7528Application\u5b58\u50a8\u5168\u5c40\u53d8\u91cf\u7684\u793a\u4f8b\u4ee3\u7801\uff1a
1.\u7ee7\u627fApplication\uff0c\u5e76\u5728Application\u91cc\u58f0\u660e\u5168\u5c40\u53d8\u91cf\u3002
public class MyApplication extends Application {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
2.\u5728AndroidManifest.xml\u7684application\u8282\u70b9\u4e2d\u58f0\u660e\u8fd9\u4e2aApplication\u3002
3.\u5728Activity\u4e2d\u83b7\u53d6Application\u5bf9\u8c61\uff0c\u5e76\u5b58\u53d6\u5168\u5c40\u53d8\u91cf\u3002
User user = new User();
user.setUserName("example");
MyrApplication app= (MyApplication ) getApplicationContext();
app.setUser(user); //\u5c06\u53d8\u91cf\u5b58\u5230application
User tmp = app.getUser();//\u4eceapplication\u4e2d\u8bfb\u53d6\u5168\u5c40\u53d8\u91cf\u3002
绛旓細android.permission.CLEAR_APP_CACHE鍏佽涓涓▼搴忔竻妤氱紦瀛樹粠鎵鏈夊畨瑁呯殑绋嬪簭鍦ㄨ澶囦腑(Allows an application to clear the caches ofall installed applications on the device. )android.permission.CLEAR_APP_USER_DATA鍏佽涓涓▼搴忔竻闄ょ敤鎴疯缃(Allows an application to clear user data)android.permission.CONTROL_...
绛旓細session灏辩粨鏉熶簡锛岃繖鍙細璇濆彉閲忋傘傘(2)application:澹版槑涓涓猘pplication鍙橀噺銆備笉鍏充綘鍓嶅彴鏈夊灏戝鎴锋墦寮璇ョ綉绔欑殑椤碉紝鏈夊灏戝鎴峰叧闂缃戠珯鐨勯〉锛屽彧瑕佹湇鍔″櫒绔笉鍏抽棴璇ョ綉绔欙紝application濮嬬粓瀛樺湪銆俛pplication锛氬叏灞浣滅敤鑼冨洿锛屾暣涓簲鐢ㄧ▼搴忓叡浜紝灏辨槸鍦ㄩ儴缃叉枃浠朵腑鐨勫悓涓涓獁ebApp鍏变韩锛岀敓鍛藉懆鏈熶负锛氬簲鐢ㄧ▼搴忓惎鍔ㄥ埌...
绛旓細Android璁块棶缃戠粶鐨勬潈闄愭槸android.permission.INTERNET銆傚0鏄庢潈闄愮殑鏂瑰紡锛氱涓姝ワ細鎵撳紑 AndroidManifest.xml鏂囦欢绗簩姝ワ細鍦application鑺傜偣涔嬪墠澧炲姞<uses-permission android:name=鈥漚ndroid.permission.INTERNET鈥></uses-permission>浠g爜涓渶瑕侀氳繃Thread鏉ヨ闂綉缁滐紝UI绾跨▼杩炴帴缃戠粶Android浼氭姏鍑哄紓甯搞傝祫鏂欐嫇灞曪細Android...
绛旓細android.permission.RESTART_PACKAGES 鍏佽绋嬪簭閲嶆柊鍚姩鍏朵粬绋嬪簭(Allows an application to restart other applications)android.permission.SEND_SMS 鍏佽绋嬪簭鍙戦丼MS鐭俊(Allows an application to send SMS messages)android.permission.SET_ACTIVITY_WATCHER 鍏佽绋嬪簭鐩戞帶鎴栨帶鍒禷ctivities宸茬粡鍚姩鍏ㄥ眬绯荤粺涓瑼llows an...
绛旓細鍦ㄤ笂涓绡囦腑浣滆呯粰澶у璇︾粏浠嬬粛浜 ASP 鍐呭缓瀵硅薄 Response 鐨勪娇鐢ㄦ柟娉,鍦ㄨ繖涓绡囦腑浣滆呭皢缁х画缁欏ぇ瀹朵粙缁嶅彟涓や釜闈炲父瀹炵敤涓旈噸瑕佺殑 ASP 鐨勫唴寤哄璞 Application 鍜 Session銆傚湪ASP 鐨勫唴寤哄璞′腑闄や簡鐢ㄤ簬鍙戦併佹帴鏀跺拰澶勭悊鏁版嵁鐨勫璞″,杩樻湁涓浜涢潪甯稿疄鐢ㄧ殑浠h〃 Active Server 搴旂敤绋嬪簭鍜屽崟涓敤鎴蜂俊鎭殑瀵硅薄銆傝鎴戜滑鍏堟潵鐪嬬湅 ...
绛旓細height="璁剧疆楂樺害" autoplay />2銆乄ebView 涓缃畐ebview缁勪欢鏀寔javascript鑴氭湰涓簍rue,load鍔犺浇璇tml銆3銆佹湁寰堝璁惧寮鍙戞椂鍙湁澹伴煶锛屾病鏈夌敾闈紝杩欎釜鏃跺欏湪androidmanifest.xml涓坊鍔犲簲鐢ㄧ▼搴application涓璁剧疆纭欢娓叉煋涓簍rue,鍦∣ncreate鍑芥暟涓惎鐢ㄧ‖浠舵覆鏌撳嵆鍙傝鐨勬湁鐐瑰惈绯娿
绛旓細绋嶆湁鐐归夯鐑︼紝绠鍗曚竴璇淬傞鍏堬紝璇风‘淇濇湁涓涓浘鏍囷紝鍦ㄦ锛屾垜鍋囪鍥炬爣鏂囦欢鐨勫悕瀛椾负: myicon.ico 璇峰姟蹇呮妸瀹冩斁鍦ㄤ綘鐨勫伐绋嬫牴鐩綍涓嬶紝灏辨槸鍜.cpp銆.dsw绛夋枃浠跺湪鍚屼竴涓洰褰曚笅锛佷箣鍚庯紝杩涘叆浣犲凡缁忓垱寤虹殑Win32 Application宸ョ▼锛屽湪FileView涓鏍忛噷锛孲ource Files鏂囦欢澶逛笅锛屾柊寤轰竴涓 Resource Script 璧勬簮鑴氭湰鏂囦欢...
绛旓細APP鏄嫳鏂Application鐨勭畝绉帮紝鐢变簬iPhone绛夋櫤鑳芥墜鏈虹殑娴佽锛孉PP鎸囨櫤鑳芥墜鏈虹殑绗笁鏂瑰簲鐢ㄧ▼搴忋傛瘮杈冭憲鍚嶇殑APP鍟嗗簵鏈夎嫻鏋滅殑Apple store锛Android鐨刧oogle play 锛岃鍩轰簹鐨凮vi store锛岃繕鏈塀lackberry鐢ㄦ埛鐨凚lackBerry App World锛屼互鍙婂井杞殑搴旂敤鍟嗗煄.浼佷笟APP鐨勬剰涔夊緢骞挎硾锛屾眹鏅哄湪绾胯涓哄彲浠ユ湁浠ヤ笅鍑犵锛1銆佸缓绔嬭嚜鏈夐攢鍞...
绛旓細鍏跺疄瀛︿範JSP鍓嶆渶濂藉厛瀛︿範Servlet,JSP鏄湪Servlet鍩虹涓婂彂灞曡屾潵鐨,鍏application瀵硅薄鍦⊿ervlet涓槸ServletContext鐨勫疄渚嬪璞,鍙互鍦ㄤ綘鍐欑殑Servlet涓氳繃this.getServletContext();鏂规硶鏉ヨ幏鍙栦竴涓猄ervletContext瀹炰緥瀵硅薄.姣斿:this.getServletContext().setAttribute("users",userList);鐒跺悗鍦ㄦ樉绀哄眰璋冪敤杩樻槸浣跨敤...
绛旓細褰撳紑鏈烘椂閬囧埌鈥淎conexant audio device could not be found, the application will now exit鈥濈殑閿欒鎻愮ず鏃讹紝鍙互鎸夌収浠ヤ笅姝ラ杩涜瑙e喅锛1. **鍏抽棴閿欒鎻愮ず**锛氶鍏堬紝鐐瑰嚮纭畾鍏抽棴閿欒鎻愮ず銆傚敖绠″畠浼氬脊鍑猴紝浣嗛氬父涓嶄細褰卞搷鍏朵粬鏃ュ父鎿嶄綔銆2. **鎵撳紑璁惧绠$悊鍣**锛氬湪鐢佃剳鐨勨滄鐢佃剳鈥濅笂鍙抽敭锛岄夋嫨鈥滃睘鎬...