锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲色欲www综合网,亚洲xxxx视频,国产成+人+综合+亚洲专http://www.tkk7.com/ZouYonghui/zh-cnFri, 09 May 2025 16:37:47 GMTFri, 09 May 2025 16:37:47 GMT60鎼緩React鐜錛岃繍琛孯eact欏圭洰http://www.tkk7.com/ZouYonghui/archive/2020/04/16/435361.htmlTerry ZouTerry ZouThu, 16 Apr 2020 07:25:00 GMThttp://www.tkk7.com/ZouYonghui/archive/2020/04/16/435361.htmlhttp://www.tkk7.com/ZouYonghui/comments/435361.htmlhttp://www.tkk7.com/ZouYonghui/archive/2020/04/16/435361.html#Feedback0http://www.tkk7.com/ZouYonghui/comments/commentRss/435361.htmlhttp://www.tkk7.com/ZouYonghui/services/trackbacks/435361.html2.瀹夎cnpm鐢╟npm鏇夸唬npm
    鍦板潃錛歨ttp://npm.taobao.org/
瀹夎cnpm:
npm install -g cnpm --registry=https://registry.npm.taobao.org

3銆佺敤yarn鏇夸唬npm
yarn鐨勫畨瑁咃細
絎竴縐嶆柟娉曪細鍙傝冨畼鏂規枃妗ttps://yarn.bootcss.com/
絎簩縐嶆柟娉曪細cnpm install -g yarn  鎴栬?npm install -g yarn
4銆佹惌寤篟eact寮鍙戠幆澧冪殑絎竴縐嶆柟娉曪紙鑰?鐜板湪鎺ㄨ崘錛夛細
https://reactjs.org/docs/create-a-new-react-app.html
1銆佸繀欏昏瀹夎nodejs     娉ㄦ剰錛氬畨瑁卬odejs紼沖畾鐗堟湰      鏁欑▼涓殑nodejs鐗堟湰:v8.11.2            鏁欑▼涓殑npm鐗堟湰:v5.6.0
2.瀹夎鑴氭墜鏋跺伐鍏?nbsp;  錛堝崟鏂囦歡緇勪歡欏圭洰鐢熸垚宸ュ叿錛?nbsp;  鍙渶瑕佸畨瑁呬竴嬈?/div>
npm install -g create-react-app   /  cnpm install -g create-react-app
3.鍒涘緩欏圭洰   錛堝彲鑳藉垱寤哄嬈★級
鎵懼埌欏圭洰瑕佸垱寤虹殑鐩綍錛?/div>
                create-react-app reactdemo
4.cd  鍒伴」鐩噷闈?span style="white-space:pre">
        cd  reactdemo
                npm start             yarn start榪愯欏圭洰
                npm run build         yarn build 鐢熸垚欏圭洰
5銆佹惌寤篟eact鐨勫紑鍙戠幆澧冪殑絎簩縐嶆柟娉曪紙鏂?鏈潵鎺ㄨ崘錛夛細
        https://reactjs.org/docs/create-a-new-react-app.html
        1銆佸繀欏昏瀹夎nodejs     娉ㄦ剰錛氬畨瑁卬odejs紼沖畾鐗堟湰      鏁欑▼涓殑nodejs鐗堟湰:v8.11.2            鏁欑▼涓殑npm鐗堟湰:v5.6.0
        2.瀹夎鑴氭墜鏋跺伐鍏峰茍鍒涘緩欏圭洰
            鎵懼埌欏圭洰瑕佸垱寤虹殑鐩綍鎵ц錛?/div>
npx create-react-app reactdemo
4.cd  鍒伴」鐩噷闈?span style="white-space: pre;">
        cd  reactdemo
                npm start  榪愯欏圭洰錛堣皟璇曪級
                npm run build 鐢熸垚欏圭洰錛堝彂甯冿級
npx浠嬬粛錛?/div>
npm v5.2.0寮曞叆鐨勪竴鏉″懡浠わ紙npx錛夛紝寮曞叆榪欎釜鍛戒護鐨勭洰鐨勬槸涓轟簡鎻愬崌寮鍙戣呬嬌鐢ㄥ寘鍐呮彁渚涚殑鍛戒護琛屽伐鍏風殑浣撻獙銆?/div>
璇︽儏錛?/div>
        npx create-react-app reactdemo榪欐潯鍛戒護浼氫復鏃跺畨瑁?create-react-app 鍖咃紝鍛戒護瀹屾垚鍚巆reate-react-app 浼氬垹鎺夛紝涓嶄細鍑虹幇鍦?global 涓備笅嬈″啀鎵ц錛岃繕鏄細閲嶆柊涓存椂瀹夎銆?/div>
npx 浼氬府浣犳墽琛屼緷璧栧寘閲岀殑浜岃繘鍒舵枃浠躲?/div>
        鍐嶆瘮濡?npx http-server 鍙互涓鍙ヨ瘽甯綘寮鍚竴涓潤鎬佹湇鍔″櫒


Terry Zou 2020-04-16 15:25 鍙戣〃璇勮
]]>Spring @PostConstruct 銆丂Autowired鍜孋onstruct 欏哄簭http://www.tkk7.com/ZouYonghui/archive/2020/04/09/435331.htmlTerry ZouTerry ZouThu, 09 Apr 2020 07:29:00 GMThttp://www.tkk7.com/ZouYonghui/archive/2020/04/09/435331.htmlhttp://www.tkk7.com/ZouYonghui/comments/435331.htmlhttp://www.tkk7.com/ZouYonghui/archive/2020/04/09/435331.html#Feedback0http://www.tkk7.com/ZouYonghui/comments/commentRss/435331.htmlhttp://www.tkk7.com/ZouYonghui/services/trackbacks/435331.html@PostConstruct
PostConstruct娉ㄩ噴鐢ㄤ簬鍦ㄥ畬鎴愪緷璧栭」娉ㄥ叆浠ユ墽琛屼換浣曞垵濮嬪寲涔嬪悗闇瑕佹墽琛岀殑鏂規硶銆傚繀欏誨湪綾繪姇鍏ヤ嬌鐢ㄤ箣鍓嶈皟鐢ㄦ鏂規硶銆?
鎵鏈夋敮鎸佷緷璧栨敞鍏ョ殑綾婚兘蹇呴』鏀寔姝ゆ敞閲娿傚嵆浣跨被娌℃湁璇鋒眰娉ㄥ叆浠諱綍璧勬簮錛屼篃蹇呴』璋冪敤浣跨敤PostConstruct娉ㄩ噴鐨勬柟娉曘?
鍙湁涓涓柟娉曞彲浠ヤ嬌鐢ㄦ鎵規敞榪涜鎵規敞銆?
搴旂敤PostConstruct娉ㄩ噴鐨勬柟娉曞繀欏繪弧瓚充互涓嬫墍鏈夋潯浠訛細闄や簡鎷︽埅鍣ㄤ箣澶栵紝鏂規硶緇濅笉鑳芥湁浠諱綍鍙傛暟錛屽湪榪欑鎯呭喌涓嬪畠閲囩敤Interceptor瑙勮寖瀹氫箟鐨処nvocationContext瀵硅薄銆?
鍦ㄦ嫤鎴櫒綾諱笂瀹氫箟鐨勬柟娉曞繀欏誨叿鏈変互涓嬬鍚嶄箣涓錛?
void <METHOD>錛圛nvocationContext錛塐bject <METHOD>錛圛nvocationContext錛夋姏鍑哄紓甯告敞鎰忥細
PostConstruct鎷︽埅鍣ㄦ柟娉曚笉鑳芥姏鍑哄簲鐢ㄧ▼搴忓紓甯革紝浣嗗彲浠ュ0鏄庡畠鎶涘嚭媯鏌ュ紓甯革紝鍖呮嫭java.lang.Exception錛?
濡傛灉鐩稿悓鐨勬嫤鎴櫒鏂規硶闄や簡鐢熷懡鍛ㄦ湡浜嬩歡涔嬪鎻掑叆涓氬姟鎴栬秴鏃舵柟娉曘?
濡傛灉PostConstruct鎷︽埅鍣ㄦ柟娉曡繑鍥炰竴涓鹼紝瀹瑰櫒灝嗗拷鐣ュ畠銆?
鍦ㄩ潪鎷︽埅鍣ㄧ被涓婂畾涔夌殑鏂規硶蹇呴』鍏鋒湁浠ヤ笅絳懼悕錛?span class="token keyword" style="box-sizing: border-box; list-style: inherit; color: #cc99cd;">void <METHOD>錛堬級搴旂敤PostConstruct鐨勬柟娉曞彲浠ユ槸public錛?span class="token keyword" style="box-sizing: border-box; list-style: inherit; color: #cc99cd;">protected錛?span class="token keyword" style="box-sizing: border-box; list-style: inherit; color: #cc99cd;">package private鎴?span class="token keyword" style="box-sizing: border-box; list-style: inherit; color: #cc99cd;">private銆?
闄ゅ簲鐢ㄧ▼搴忓鎴風澶栵紝璇ユ柟娉曠粷涓嶈兘鏄潤鎬佺殑銆?
璇ユ柟娉曞彲鑳芥槸鏈緇堢殑銆傚鏋滆鏂規硶鎶涘嚭涓涓湭緇忔鏌ョ殑寮傚父錛岄偅涔堣綾葷粷涓嶈兘鎶曞叆浣跨敤錛岄櫎闈濫JB鍙互澶勭悊寮傚父鐢氳嚦浠庡畠浠仮澶嶇殑EJB

鐒跺悗灝變細鎬濊冮棶棰橈紝榪欎釜娉ㄩ噴鏄慨楗板垵濮嬪寲涔嬪悗闇瑕佹墽琛岀殑鏂規硶錛岄偅涔堝畠鍜孈Autowired銆佹瀯閫犲嚱鏁扮殑鎵ц欏哄簭鏄粈涔堝憿錛燂紙褰撶劧娉ㄩ噴涓凡緇忚鏄庝簡PostConstruct娉ㄩ噴鐢ㄤ簬鍦ㄥ畬鎴愪緷璧栭」娉ㄥ叆涔嬪悗錛?br />
@Service
public class BeanA {

    @Autowired
    private BeanB beanB;

    public BeanA() {
        System.out.println("榪欐槸Bean A 鐨勬瀯閫犳柟娉?);
    }
    @PostConstruct
    private void init() {
        System.out.println("榪欐槸BeanA鐨?nbsp;init 鏂規硶");
        beanB.testB();
    }
}
@Service
public class BeanB {

    @PostConstruct
    private void init() {
        System.out.println("榪欐槸BeanB 鐨刬nit 鏂規硶");
    }
    public BeanB() {
        System.out.println("榪欐槸Bean B鐨?nbsp;鏋勯犳柟娉?);
    }
    void testB() {
        System.out.println("榪欐槸Bean B 鐨?nbsp;testB 鏂規硶");
    }
}

鍚姩鍚庤緭鍑?
榪欐槸Bean A 鐨勬瀯閫犳柟娉?
榪欐槸Bean B鐨?鏋勯犳柟娉?
榪欐槸BeanB 鐨刬nit 鏂規硶
榪欐槸BeanA鐨?init 鏂規硶
榪欐槸Bean B 鐨?testB 鏂規硶

鎵浠ュ緱鍒扮粨璁猴細 鏋勯犳柟娉?> @Autowired > @PostConstruct


Terry Zou 2020-04-09 15:29 鍙戣〃璇勮
]]>
Spring涓殑ApplicationListener鐨勪嬌鐢ㄨ瑙f渚嬶紙瑙傚療鑰呮ā寮?http://www.tkk7.com/ZouYonghui/archive/2020/04/09/435329.htmlTerry ZouTerry ZouThu, 09 Apr 2020 06:47:00 GMThttp://www.tkk7.com/ZouYonghui/archive/2020/04/09/435329.htmlhttp://www.tkk7.com/ZouYonghui/comments/435329.htmlhttp://www.tkk7.com/ZouYonghui/archive/2020/04/09/435329.html#Feedback0http://www.tkk7.com/ZouYonghui/comments/commentRss/435329.htmlhttp://www.tkk7.com/ZouYonghui/services/trackbacks/435329.html1銆丄pplicationContext
Spring鐨勬牳蹇冿紝Context鎴戜滑閫氬父瑙i噴涓轟笂涓嬫枃鐜銆侫pplicationContext鍒欐槸搴旂敤鐨勫鍣ㄣ?Spring鎶夿ean錛坥bject錛夋斁鍦ㄥ鍣ㄤ腑錛岄渶瑕佺敤灝遍氳繃get鏂規硶鍙栧嚭鏉ャ傚湪ApplicationContext鎺ュ彛鐨勪紬澶氬疄鐜扮被涓紝鏈?涓槸鎴戜滑緇忓父鐢ㄥ埌鐨勶紙瑙佽〃1-1錛夛紝騫朵笖浣跨敤榪?涓疄鐜扮被涔熷熀鏈兘婊¤凍鎴戜滑Java EE搴旂敤寮鍙戜腑鐨勭粷澶ч儴鍒嗛渶姹傘?/div>
琛?-1 ApplicationContext鎺ュ彛鐨勫父鐢ㄥ疄鐜扮被浠嬬粛
ClassPathXmlApplicationContext
浠庣被璺緞ClassPath涓鎵炬寚瀹氱殑XML閰嶇疆鏂囦歡錛屾壘鍒板茍瑁呰澆瀹屾垚ApplicationContext鐨勫疄渚嬪寲宸ヤ綔銆備緥濡傦細 //瑁呰澆鍗曚釜閰嶇疆鏂囦歡瀹炰緥鍖朅pplicationContext瀹瑰櫒
ApplicationContext cxt = new ClassPathXmlApplicationContext("applicationContext.xml");
//瑁呰澆澶氫釜閰嶇疆鏂囦歡瀹炰緥鍖朅pplicationContext瀹瑰櫒
String[] configs = {"bean1.xml","bean2.xml","bean3.xml"};
ApplicationContext cxt = new ClassPathXmlApplicationContext(configs);
FileSystemXmlApplicationContext
浠庢寚瀹氱殑鏂囦歡緋葷粺璺緞涓鎵炬寚瀹氱殑XML閰嶇疆鏂囦歡錛屾壘鍒板茍瑁呰澆瀹屾垚ApplicationContext鐨勫疄渚嬪寲宸ヤ綔銆備緥濡傦細//瑁呰澆鍗曚釜閰嶇疆鏂囦歡瀹炰緥鍖朅pplicationContext瀹瑰櫒
ApplicationContext cxt = new FileSystemXMLApplicationContext("beans.xml");
//瑁呰澆澶氫釜閰嶇疆鏂囦歡瀹炰緥鍖朅pplicationContext瀹瑰櫒
String[] configs = {"c:/beans1.xml","c:/beans2.xml"};
ApplicationContext cxt = new FileSystemXmlApplicationContext(configs);
XmlWebApplicationContext
浠嶹eb搴旂敤涓鎵炬寚瀹氱殑XML閰嶇疆鏂囦歡錛屾壘鍒板茍瑁呰澆瀹屾垚ApplicationContext鐨勫疄渚嬪寲宸ヤ綔銆傝繖鏄負Web宸ョ▼閲忚韓瀹氬埗鐨勶紝浣跨敤WebApplicationContextUtils綾葷殑getRequiredWebApplicationContext鏂規硶鍙湪JSP涓嶴ervlet涓彇寰桰oC瀹瑰櫒鐨勫紩鐢?/div>
2銆丄pplicationEvent
鏄釜鎶借薄綾伙紝閲岄潰鍙湁涓涓瀯閫犲嚱鏁板拰涓涓暱鏁村瀷鐨則imestamp銆傚叾婧愮爜濡備笅

public abstract class ApplicationEvent extends EventObject {
 
    /** use serialVersionUID from Spring 1.2 for interoperability */
    private static final long serialVersionUID = 7099057708183571937L;
 
    /** System time when the event happened */
    private final long timestamp;
 
    /**
     * Create a new ApplicationEvent.
     * 
@param source the object on which the event initially occurred (never {@code null})
     
*/
    public ApplicationEvent(Object source) {
        super(source);
        this.timestamp = System.currentTimeMillis();
    }
 
    /**
     * Return the system time in milliseconds when the event happened.
     
*/
    public final long getTimestamp() {
        return this.timestamp;
    }
}

3銆丄pplicationListener

鏄竴涓帴鍙o紝閲岄潰鍙湁涓涓猳nApplicationEvent鏂規硶銆傚鏋滃湪涓婁笅鏂囦腑閮ㄧ講涓涓疄鐜頒簡ApplicationListener鎺ュ彛鐨刡ean,閭d箞姣忓綋鍦ㄤ竴涓狝pplicationEvent鍙戝竷鍒?ApplicationContext鏃訛紝璋冪敤ApplicationContext.publishEvent()鏂規硶錛岃繖涓猙ean寰楀埌閫氱煡銆傜被浼間簬Oberver璁捐妯″紡銆?/span>
鍏舵簮鐮佸涓嬶細

public interface ApplicationListener<E extends ApplicationEvent> extends EventListener {
    /**
     * Handle an application event.
     * 
@param event the event to respond to
     
*/
    void onApplicationEvent(E event);
 
}
涓嬮潰涓句釜渚嬪瓙
鑷畾涔変簨浠禢otifyEvent:
import org.springframework.context.ApplicationEvent;

public class NotifyEvent  extends ApplicationEvent  {
    private String email;
    private String content;
    public NotifyEvent(Object source){
        super(source);
    }

    public NotifyEvent(Object source,String email,String content){
        super(source);
        this.email = email;
        this.content = content;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}

瀹氫箟鐩戝惉鍣∟otifyListener:
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;

@Configuration
public class NotifyListener implements ApplicationListener<NotifyEvent>{
    @Override
    public void onApplicationEvent(NotifyEvent event) {
        System.out.println("閭歡鍦板潃錛? + event.getEmail());
        System.out.println("閭歡鍐呭錛? + event.getContent());
    }
}

鍗曞厓嫻嬭瘯綾籐istenerTest錛?/span>
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.context.WebApplicationContext;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = ServerLauncher.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ListenerTest {
    @Autowired
    private WebApplicationContext webApplicationContext;

    @Test
    public void testListener(){
        NotifyEvent event = new NotifyEvent("object","abc@qq.com","This is the content");
        webApplicationContext.publishEvent(event);
    }
}


Terry Zou 2020-04-09 14:47 鍙戣〃璇勮
]]>@SpringBootApplication鐨勪嬌鐢?/title><link>http://www.tkk7.com/ZouYonghui/archive/2020/04/09/435328.html</link><dc:creator>Terry Zou</dc:creator><author>Terry Zou</author><pubDate>Thu, 09 Apr 2020 01:10:00 GMT</pubDate><guid>http://www.tkk7.com/ZouYonghui/archive/2020/04/09/435328.html</guid><wfw:comment>http://www.tkk7.com/ZouYonghui/comments/435328.html</wfw:comment><comments>http://www.tkk7.com/ZouYonghui/archive/2020/04/09/435328.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/ZouYonghui/comments/commentRss/435328.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/ZouYonghui/services/trackbacks/435328.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; font-family: "black Verdana", Arial, Helvetica, sans-serif; background-color: #ffffff;">涔嬪墠鐢ㄦ埛浣跨敤鐨勬槸3涓敞瑙f敞瑙d粬浠殑main綾匯傚垎鍒槸@Configuration,@EnableAutoConfiguration,@ComponentScan銆傜敱浜庤繖浜涙敞瑙d竴鑸兘鏄竴璧蜂嬌鐢紝spring boot鎻愪緵浜嗕竴涓粺涓鐨勬敞瑙SpringBootApplication銆?/p> <p style="margin-top: 10px; margin-bottom: 10px; font-family: "black Verdana", Arial, Helvetica, sans-serif; background-color: #ffffff;">@SpringBootApplication = (榛樿灞炴?@Configuration + @EnableAutoConfiguration + @ComponentScan銆?br /></p><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->@SpringBootApplication <br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> ApplicationMain { <br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">void</span> main(String[] args) { <br />        SpringApplication.run(Application.<span style="color: #0000FF; ">class</span>, args); <br />    } <br />}</div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "black Verdana", Arial, Helvetica, sans-serif; background-color: #ffffff;">鍒嗗紑瑙i噴@Configuration,@EnableAutoConfiguration,@ComponentScan銆?br />1銆丂Configuration錛氭彁鍒癅Configuration灝辮鎻愬埌浠栫殑鎼。@Bean銆備嬌鐢ㄨ繖涓や釜娉ㄨВ灝卞彲浠ュ垱寤轟竴涓畝鍗曠殑spring閰嶇疆綾伙紝鍙互鐢ㄦ潵鏇夸唬鐩稿簲鐨剎ml閰嶇疆鏂囦歡銆?br /></p><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><beans> <br />    <bean id = "car" <span style="color: #0000FF; ">class</span>="com.test.Car"> <br />        <property name="wheel" ref = "wheel"></property> <br />    </bean> <br />    <bean id = "wheel" <span style="color: #0000FF; ">class</span>="com.test.Wheel"></bean> <br /></beans> </div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "black Verdana", Arial, Helvetica, sans-serif; background-color: #ffffff;"> 鐩稿綋浜庯細<br /></p><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->@Configuration <br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> Conf { <br />    @Bean <br />    <span style="color: #0000FF; ">public</span> Car car() { <br />        Car car = <span style="color: #0000FF; ">new</span> Car(); <br />        car.setWheel(wheel()); <br />        <span style="color: #0000FF; ">return</span> car; <br />    } <br />    @Bean  <br />    <span style="color: #0000FF; ">public</span> Wheel wheel() { <br />        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> Wheel(); <br />    } <br />}</div><p style="margin-top: 10px; margin-bottom: 10px; font-family: "black Verdana", Arial, Helvetica, sans-serif; background-color: #ffffff;">@Configuration鐨勬敞瑙g被鏍囪瘑榪欎釜綾誨彲浠ヤ嬌鐢⊿pring IoC瀹瑰櫒浣滀負bean瀹氫箟鐨勬潵婧愩侤Bean娉ㄨВ鍛婅瘔Spring錛屼竴涓甫鏈堾Bean鐨勬敞瑙f柟娉曞皢榪斿洖涓涓璞★紝璇ュ璞″簲璇ヨ娉ㄥ唽涓哄湪Spring搴旂敤紼嬪簭涓婁笅鏂囦腑鐨刡ean銆?br /></p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "black Verdana", Arial, Helvetica, sans-serif; background-color: #ffffff;">2銆丂EnableAutoConfiguration錛氳兘澶熻嚜鍔ㄩ厤緗畇pring鐨勪笂涓嬫枃錛岃瘯鍥劇寽嫻嬪拰閰嶇疆浣犳兂瑕佺殑bean綾伙紝閫氬父浼氳嚜鍔ㄦ牴鎹綘鐨勭被璺緞鍜屼綘鐨刡ean瀹氫箟鑷姩閰嶇疆銆?/p><p style="margin-top: 10px; margin-bottom: 10px; font-family: "black Verdana", Arial, Helvetica, sans-serif; background-color: #ffffff;">3銆丂ComponentScan錛氫細鑷姩鎵弿鎸囧畾鍖呬笅鐨勫叏閮ㄦ爣鏈堾Component鐨勭被錛屽茍娉ㄥ唽鎴恇ean錛屽綋鐒跺寘鎷珸Component涓嬬殑瀛愭敞瑙Service,@Repository,@Controller銆?/p><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><p><br /> </p> </div><img src ="http://www.tkk7.com/ZouYonghui/aggbug/435328.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/ZouYonghui/" target="_blank">Terry Zou</a> 2020-04-09 09:10 <a href="http://www.tkk7.com/ZouYonghui/archive/2020/04/09/435328.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鏈嶅姟鍣ㄨ繛鎺?/title><link>http://www.tkk7.com/ZouYonghui/archive/2015/07/13/426208.html</link><dc:creator>Terry Zou</dc:creator><author>Terry Zou</author><pubDate>Mon, 13 Jul 2015 14:10:00 GMT</pubDate><guid>http://www.tkk7.com/ZouYonghui/archive/2015/07/13/426208.html</guid><wfw:comment>http://www.tkk7.com/ZouYonghui/comments/426208.html</wfw:comment><comments>http://www.tkk7.com/ZouYonghui/archive/2015/07/13/426208.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/ZouYonghui/comments/commentRss/426208.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/ZouYonghui/services/trackbacks/426208.html</trackback:ping><description><![CDATA[<div><span style="font-size: 12px;">package com.zhihe.xqsh.utils;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">import java.io.File;</span></div><div><span style="font-size: 12px;">import java.io.FileOutputStream;</span></div><div><span style="font-size: 12px;">import java.io.IOException;</span></div><div><span style="font-size: 12px;">import java.io.InputStream;</span></div><div><span style="font-size: 12px;">import java.io.UnsupportedEncodingException;</span></div><div><span style="font-size: 12px;">import java.util.Date;</span></div><div><span style="font-size: 12px;">import java.util.List;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">import org.apache.http.HttpEntity;</span></div><div><span style="font-size: 12px;">import org.apache.http.HttpResponse;</span></div><div><span style="font-size: 12px;">import org.apache.http.HttpStatus;</span></div><div><span style="font-size: 12px;">import org.apache.http.HttpVersion;</span></div><div><span style="font-size: 12px;">import org.apache.http.NameValuePair;</span></div><div><span style="font-size: 12px;">import org.apache.http.client.ClientProtocolException;</span></div><div><span style="font-size: 12px;">import org.apache.http.client.HttpClient;</span></div><div><span style="font-size: 12px;">import org.apache.http.client.entity.UrlEncodedFormEntity;</span></div><div><span style="font-size: 12px;">import org.apache.http.client.methods.HttpGet;</span></div><div><span style="font-size: 12px;">import org.apache.http.client.methods.HttpPost;</span></div><div><span style="font-size: 12px;">import org.apache.http.conn.ClientConnectionManager;</span></div><div><span style="font-size: 12px;">import org.apache.http.conn.params.ConnManagerParams;</span></div><div><span style="font-size: 12px;">import org.apache.http.conn.params.ConnRouteParams;</span></div><div><span style="font-size: 12px;">import org.apache.http.conn.scheme.PlainSocketFactory;</span></div><div><span style="font-size: 12px;">import org.apache.http.conn.scheme.Scheme;</span></div><div><span style="font-size: 12px;">import org.apache.http.conn.scheme.SchemeRegistry;</span></div><div><span style="font-size: 12px;">import org.apache.http.conn.ssl.SSLSocketFactory;</span></div><div><span style="font-size: 12px;">import org.apache.http.impl.client.DefaultHttpClient;</span></div><div><span style="font-size: 12px;">import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;</span></div><div><span style="font-size: 12px;">import org.apache.http.impl.cookie.BasicClientCookie;</span></div><div><span style="font-size: 12px;">import org.apache.http.params.BasicHttpParams;</span></div><div><span style="font-size: 12px;">import org.apache.http.params.HttpConnectionParams;</span></div><div><span style="font-size: 12px;">import org.apache.http.params.HttpParams;</span></div><div><span style="font-size: 12px;">import org.apache.http.params.HttpProtocolParams;</span></div><div><span style="font-size: 12px;">import org.apache.http.util.EntityUtils;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">import com.zhihe.xqsh.network.ServerErrorException;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">import android.accounts.NetworkErrorException;</span></div><div><span style="font-size: 12px;">import android.annotation.SuppressLint;</span></div><div><span style="font-size: 12px;">import android.util.Log;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">public class CustomerHttpClient {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>private static final String TAG = CustomerHttpClient.class.getSimpleName();</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>private static DefaultHttpClient customerHttpClient;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>private CustomerHttpClient() {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static synchronized HttpClient getHttpClient() {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (null == customerHttpClient) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpParams params = new BasicHttpParams();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 璁劇疆錕?錕斤拷鍩烘湰鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpProtocolParams.setContentCharset(params, "UTF-8");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpProtocolParams.setUseExpectContinue(params, true);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpProtocolParams.setUserAgent(params, "Mozilla/5.0(Linux;U;Android 2.2.1;en-us;Nexus One Build.FRG83) "</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>+ "AppleWebKit/553.1(KHTML,like Gecko) Version/4.0 Mobile Safari/533.1");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 瓚呮椂璁劇疆</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/* 浠庤繛鎺ユ睜涓彇榪炴帴鐨勮秴鏃舵椂錕?*/</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>ConnManagerParams.setTimeout(params, 2000);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>ConnManagerParams.setMaxTotalConnections(params, 800);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/* 榪炴帴瓚呮椂 */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpConnectionParams.setConnectionTimeout(params, 5000);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/* 璇鋒眰瓚呮椂 */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpConnectionParams.setSoTimeout(params, 10000);</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 璁劇疆鎴戜滑鐨凥ttpClient鏀寔HTTP鍜孒TTPS涓ょ妯″紡</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>SchemeRegistry schReg = new SchemeRegistry();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>schReg.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>schReg.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 浣跨敤綰跨▼瀹夊叏鐨勮繛鎺ョ鐞嗘潵鍒涘緩HttpClient</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>ClientConnectionManager conMgr = new ThreadSafeClientConnManager(params, schReg);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 錕?錕斤拷榪炴帴鏁幫細ConnManagerParams.setMaxTotalConnections(params, 50);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>customerHttpClient = new DefaultHttpClient(conMgr, params);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return customerHttpClient;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/**</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * 浠et鏂瑰紡鎻愪氦鏁版嵁</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param url 鎻愪氦鍦板潃</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param params 鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @return 鍝嶅簲緇撴灉</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws ServerErrorException 璇鋒眰澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws NetworkErrorException 榪炴帴澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static String get(String url, String params) throws ServerErrorException, NetworkErrorException {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>int tryTimes = 0;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>NullPointerException ex;</span></div><div><span style="white-space: pre; font-size: 12px;"> </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>do {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>try {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return tryGet(url, params);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (NullPointerException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>ex = e;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>tryTimes++;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} while (tryTimes < 3);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw ex;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/**</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * 浠et鏂瑰紡鎻愪氦鏁版嵁</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param url 鎻愪氦鍦板潃</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param params 鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @return 鍝嶅簲緇撴灉</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws ServerErrorException 璇鋒眰澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws NetworkErrorException 榪炴帴澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static String tryGet(String url, String params) throws ServerErrorException, NetworkErrorException {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>try {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpGet request = new HttpGet(url + params);</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/*if (LotteryApplication.isCmwap()) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>org.apache.http.HttpHost proxy = new org.apache.http.HttpHost("10.0.0.172", 80, "http");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpParams httpParams = new BasicHttpParams();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>ConnRouteParams.setDefaultProxy(httpParams, proxy);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>request.setParams(httpParams);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}*/</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpClient client = getHttpClient();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpResponse response = client.execute(request);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw new ServerErrorException("錕斤拷錕斤拷錕斤拷錕斤拷æ錕斤拷錕斤拷錕皆猴拷錕斤拷錕斤拷");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpEntity resEntity = response.getEntity();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>String result = (resEntity == null) ? null : EntityUtils.toString(resEntity, "UTF-8");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return result;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (UnsupportedEncodingException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>logw(e.getMessage());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return null;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (ClientProtocolException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>logw(e.getMessage());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return null;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (IOException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw new NetworkErrorException("錕斤拷錕接詫拷錕繳癸拷錕斤拷錕斤拷錕斤拷錕斤拷錕斤拷錕斤拷錕斤拷", e);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>private static void logw(String string) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (string != null) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Log.w(TAG, string);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/**</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * 浠ost鏂瑰紡鎻愪氦鏁版嵁</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param url 鎻愪氦鍦板潃</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param params 鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @return 鍝嶅簲緇撴灉</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws ServerErrorException 璇鋒眰澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws NetworkErrorException 榪炴帴澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static String post(String url, List<NameValuePair> params) throws ServerErrorException, NetworkErrorException {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return post(url, params, null);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/**</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * 浠ost鏂瑰紡鎻愪氦鏁版嵁</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param url 鎻愪氦鍦板潃</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param params 鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param soTimeout 鍝嶅簲瓚呮椂鏃墮棿錛屽崟浣嶆錕?</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @return 鍝嶅簲緇撴灉</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws ServerErrorException 璇鋒眰澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws NetworkErrorException 榪炴帴澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static String post(String url, List<NameValuePair> params, int soTimeout) throws ServerErrorException,</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>NetworkErrorException {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpParams httpParams;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (soTimeout <= 0) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>httpParams = null;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} else {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>httpParams = new BasicHttpParams();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpConnectionParams.setSoTimeout(httpParams, soTimeout);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return post(url, params, httpParams);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/**</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * 浠ost鏂瑰紡鎻愪氦鏁版嵁</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param url 鎻愪氦鍦板潃</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param params 鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param httpParams http鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @return 鍝嶅簲緇撴灉</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws ServerErrorException 璇鋒眰澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws NetworkErrorException 榪炴帴澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static String post(String url, List<NameValuePair> params, HttpParams httpParams) throws ServerErrorException,</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>NetworkErrorException {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>int tryTimes = 0;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>NullPointerException ex;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>do {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>try {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return tryPost(url, params, httpParams);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (NullPointerException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>ex = e;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>tryTimes++;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} while (tryTimes < 3);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw ex;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/**</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * 浠ost鏂瑰紡鎻愪氦鏁版嵁</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param url 鎻愪氦鍦板潃</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param params 鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param httpParams http鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @return 鍝嶅簲緇撴灉</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws ServerErrorException 璇鋒眰澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @throws NetworkErrorException 榪炴帴澶辮觸</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static String tryPost(String url, List<NameValuePair> params, HttpParams httpParams) throws ServerErrorException,</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>NetworkErrorException {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>try {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpPost request = new HttpPost(url);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (params != null && params.size() > 0) {<span style="white-space:pre"> </span></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>request.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">//<span style="white-space:pre"> </span>if (LotteryApplication.isCmwap()) {</span></div><div><span style="font-size: 12px;">//<span style="white-space:pre"> </span>org.apache.http.HttpHost proxy = new org.apache.http.HttpHost("10.0.0.172", 80, "http");</span></div><div><span style="font-size: 12px;">//<span style="white-space:pre"> </span>if (httpParams == null)</span></div><div><span style="font-size: 12px;">//<span style="white-space:pre"> </span>httpParams = new BasicHttpParams();</span></div><div><span style="font-size: 12px;">//<span style="white-space:pre"> </span>ConnRouteParams.setDefaultProxy(httpParams, proxy);</span></div><div><span style="font-size: 12px;">//<span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (httpParams != null)</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>request.setParams(httpParams);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>//Log.v("CS", params.toString());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpClient client = getHttpClient();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpResponse response = client.execute(request);</span></div><div><span style="white-space: pre; font-size: 12px;"> </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>//Log.v("CS", params.toString());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>//Log.v("CS", response.getStatusLine().getStatusCode() + "");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>request.abort(); </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw new ServerErrorException("錕斤拷錕斤拷錕斤拷錕斤拷æ錕斤拷錕斤拷錕皆猴拷錕斤拷錕斤拷");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (response.getStatusLine ().getStatusCode () != 200) {  </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>request.abort();  //錕叫訛拷錕斤拷錕斤拷,錕斤拷錕斤拷錕斤拷錕斤拷錕皆匡拷始錕斤拷一錕斤拷錕斤拷錕斤拷</span></div><div><span style="font-size: 12px;">                return null;  </span></div><div><span style="font-size: 12px;">            } </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpEntity resEntity = response.getEntity();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>String result = (resEntity == null) ? null : EntityUtils.toString(resEntity, "UTF-8");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>//Log.v("CS", params.toString() + "||||" + result);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return result;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (UnsupportedEncodingException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>logw(e.getMessage());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return null;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (ClientProtocolException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>logw(e.getMessage());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return null;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (IOException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw new NetworkErrorException(e.getMessage(), e);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>//throw new NetworkErrorException("榪炴帴涓嶆垚鍔燂紝璇鋒鏌ョ綉緇滆錕?, e);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>@SuppressLint("SdCardPath")</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static String download(String url) throws ServerErrorException, NetworkErrorException {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>try {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>//Log.i("http-download", url);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpPost request = new HttpPost(url);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpClient client = getHttpClient();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpResponse response = client.execute(request);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw new ServerErrorException("錕斤拷錕斤拷錕斤拷錕斤拷æ錕斤拷錕斤拷錕皆猴拷錕斤拷錕斤拷");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>HttpEntity entity = response.getEntity();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>InputStream is = entity.getContent();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (is == null)</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw new ServerErrorException("stream is null ");</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>String fileExt = url.substring(url.lastIndexOf(".") + 1, url.length()).toLowerCase();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>String fileName = url.substring(url.lastIndexOf("/") + 1, url.lastIndexOf("."));</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>File tempFile = new File("/sdcard/" + fileName + "." + fileExt);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (!tempFile.exists())</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>tempFile.createNewFile();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>FileOutputStream fileOutputStream = new FileOutputStream(tempFile);</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>byte[] buf = new byte[1024];</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>int ch;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>while ((ch = is.read(buf)) != -1) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>fileOutputStream.write(buf, 0, ch);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>fileOutputStream.flush();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>fileOutputStream.close();</span></div><div><span style="white-space: pre; font-size: 12px;"> </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return tempFile.getAbsolutePath();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (UnsupportedEncodingException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>logw(e.getMessage());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return null;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (ClientProtocolException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>logw(e.getMessage());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return null;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>} catch (IOException e) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>throw new NetworkErrorException(e.getMessage(), e);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/**</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * 娓呯┖cookie</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static void clearCookie() {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (customerHttpClient != null)</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>customerHttpClient.getCookieStore().clear();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>/**</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * 娓呴櫎鎸囧畾cookie</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * </span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> * @param name cookie鍚嶇О</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span> */</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>public static void clearCookie(String name) {</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>if (customerHttpClient == null)</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>return;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>BasicClientCookie expiredCookie = new BasicClientCookie(name, "null");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>expiredCookie.setExpiryDate(new Date(System.currentTimeMillis() - 1000));</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>customerHttpClient.getCookieStore().addCookie(expiredCookie);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;">}</span></div><div style="font-family: Tahoma; font-size: 11px;"></div><img src ="http://www.tkk7.com/ZouYonghui/aggbug/426208.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/ZouYonghui/" target="_blank">Terry Zou</a> 2015-07-13 22:10 <a href="http://www.tkk7.com/ZouYonghui/archive/2015/07/13/426208.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>ffghttp://www.tkk7.com/ZouYonghui/archive/2015/07/13/426185.htmlTerry ZouTerry ZouMon, 13 Jul 2015 03:04:00 GMThttp://www.tkk7.com/ZouYonghui/archive/2015/07/13/426185.htmlhttp://www.tkk7.com/ZouYonghui/comments/426185.htmlhttp://www.tkk7.com/ZouYonghui/archive/2015/07/13/426185.html#Feedback0http://www.tkk7.com/ZouYonghui/comments/commentRss/426185.htmlhttp://www.tkk7.com/ZouYonghui/services/trackbacks/426185.html

Terry Zou 2015-07-13 11:04 鍙戣〃璇勮
]]>
abehttp://www.tkk7.com/ZouYonghui/archive/2015/07/09/426109.htmlTerry ZouTerry ZouWed, 08 Jul 2015 16:04:00 GMThttp://www.tkk7.com/ZouYonghui/archive/2015/07/09/426109.htmlhttp://www.tkk7.com/ZouYonghui/comments/426109.htmlhttp://www.tkk7.com/ZouYonghui/archive/2015/07/09/426109.html#Feedback0http://www.tkk7.com/ZouYonghui/comments/commentRss/426109.htmlhttp://www.tkk7.com/ZouYonghui/services/trackbacks/426109.html
private Drawable img_time_filter,img_time_filter_selected ;
//榪囨護鍣═extView涓樉紺虹殑鍥劇墖
img_time_filter = getResources().getDrawable(R.drawable.time_filter);
//璋冪敤setCompoundDrawables鏃訛紝蹇呴』璋冪敤Drawable.setBounds()鏂規硶,鍚﹀垯鍥劇墖涓嶆樉紺?/div>
img_time_filter.setBounds(0, 0, img_time_filter.getMinimumWidth(), img_time_filter.getMinimumHeight());
img_time_filter_selected = getResources().getDrawable(R.drawable.time_filter_selected);
img_time_filter_selected.setBounds(0, 0, img_time_filter_selected.getMinimumWidth(), img_time_filter_selected.getMinimumHeight());
tv_filterTime.setCompoundDrawables(img_time_filter_selected, null, null, null);
tv_filterTime.setTextColor(getResources().getColor(R.color.white));
rl_filterTime.setBackgroundColor(getResources().getColor(R.color.red));

tv_filterTime.setCompoundDrawables(img_time_filter, null, null, null);
rl_filterTime.setBackgroundColor(getResources().getColor(R.color.white)); 
lv_filterTime.setVisibility(View.INVISIBLE);


Terry Zou 2015-07-09 00:04 鍙戣〃璇勮
]]>
Android涔婣ctivity鐨勫洓縐嶅惎鍔ㄦā寮?/title><link>http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425872.html</link><dc:creator>Terry Zou</dc:creator><author>Terry Zou</author><pubDate>Wed, 24 Jun 2015 10:10:00 GMT</pubDate><guid>http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425872.html</guid><wfw:comment>http://www.tkk7.com/ZouYonghui/comments/425872.html</wfw:comment><comments>http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425872.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/ZouYonghui/comments/commentRss/425872.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/ZouYonghui/services/trackbacks/425872.html</trackback:ping><description><![CDATA[<p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><span style="line-height: 1.5">杞澆錛?a >http://www.cnblogs.com/allenzheng/archive/2013/04/28/3050065.html</a><br />褰撳簲鐢ㄨ繍琛岃搗鏉ュ悗灝變細寮鍚竴鏉$嚎紼嬶紝綰跨▼涓細榪愯涓涓換鍔℃爤錛屽綋<span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">瀹炰緥鍒涘緩鍚庡氨浼氭斁鍏ヤ換鍔℃爤涓?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity鍚姩</span><span style="line-height: 1.5; font-family: 瀹嬩綋">妯″紡鐨勮緗湪</span></span><span style="line-height: 1.5">AndroidManifest.</span><span style="line-height: 1.5">xml</span><span style="line-height: 1.5">鏂囦歡涓紝閫氳繃閰嶇疆</span><span style="line-height: 1.5">Activity<span style="line-height: 1.5; font-family: 瀹嬩綋">鐨勫睘鎬?/span></span><span style="line-height: 1.5">android:launchMode</span><span style="line-height: 1.5">=</span><span style="line-height: 1.5">""</span><span style="line-height: 1.5">璁劇疆</span><span style="line-height: 1.5">銆?/span></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><span style="line-height: 1.5"> </span></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><strong><span style="line-height: 1.5">1. </span><span style="line-height: 1.5">Standared<span style="line-height: 1.5; font-family: 瀹嬩綋">妯″紡錛堥粯璁わ級</span></span></strong></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><span style="line-height: 1.5">鎴戜滑騫蟲椂鐩存帴鍒涘緩鐨?span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">閮芥槸榪欑妯″紡鐨?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">錛岃繖縐嶆ā寮忕殑</span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">鐨勭壒鐐規槸錛氬彧瑕佷綘鍒涘緩浜?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">瀹炰緥錛屼竴鏃︽縺媧昏</span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">錛屽垯浼氬悜浠誨姟鏍堜腑鍔犲叆鏂板垱寤虹殑瀹炰緥錛岄鍑?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">鍒欎細鍦ㄤ換鍔℃爤涓攢姣佽瀹炰緥銆?/span></span></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"> </p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><strong><span style="line-height: 1.5">2. </span><span style="line-height: 1.5">SingleTop<span style="line-height: 1.5; font-family: 瀹嬩綋">妯″紡</span></span></strong></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><span style="line-height: 1.5">榪欑妯″紡浼氳冭檻褰撳墠瑕佹縺媧葷殑<span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">瀹炰緥鍦ㄤ換鍔℃爤涓槸鍚︽澶勪簬鏍堥《錛屽鏋滃浜庢爤欏跺垯鏃犻渶閲嶆柊鍒涘緩鏂扮殑瀹炰緥錛屼細閲嶇敤宸插瓨鍦ㄧ殑瀹炰緥錛屽惁鍒欎細鍦ㄤ換鍔℃爤涓垱寤烘柊鐨勫疄渚嬨?/span></span></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><span style="line-height: 1.5"> </span></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><strong><span style="line-height: 1.5">3. </span><span style="line-height: 1.5">SingleTask<span style="line-height: 1.5; font-family: 瀹嬩綋">妯″紡</span></span></strong></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><span style="line-height: 1.5">濡傛灉浠誨姟鏍堜腑瀛樺湪璇ユā寮忕殑<span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">瀹炰緥錛屽垯鎶婃爤涓瀹炰緥浠ヤ笂鐨?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">瀹炰緥鍏ㄩ儴縐婚櫎錛岃皟鐢ㄨ瀹炰緥鐨?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">newInstance()</span><span style="line-height: 1.5; font-family: 瀹嬩綋">鏂規硶閲嶇敤璇?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">錛屼嬌璇ュ疄渚嬪鏂兼爤欏朵綅緗紝鍚﹀垯灝遍噸鏂板垱寤轟竴涓柊鐨?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">瀹炰緥銆?/span></span></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"> </p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><strong><span style="line-height: 1.5">4. </span><span style="line-height: 1.5">SingleInstance<span style="line-height: 1.5; font-family: 瀹嬩綋">妯″紡</span></span></strong></p> <p style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto 10px 30px; font: 13px/19px Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; letter-spacing: normal; color: rgb(75,75,75); word-spacing: 0px; -webkit-text-stroke-width: 0px" class="p0"><span style="line-height: 1.5">褰撹妯″紡<span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">瀹炰緥鍦ㄤ換鍔℃爤涓垱寤哄悗錛屽彧瑕佽瀹炰緥榪樺湪浠誨姟鏍堜腑錛屽嵆鍙嬋媧葷殑鏄綾誨瀷鐨?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">錛岄兘浼氶氳繃璋冪敤瀹炰緥鐨?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">newInstance()</span><span style="line-height: 1.5; font-family: 瀹嬩綋">鏂規硶閲嶇敤璇?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">錛屾鏃朵嬌鐢ㄧ殑閮芥槸鍚屼竴涓?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity瀹炰緥</span><span style="line-height: 1.5; font-family: 瀹嬩綋">錛屽畠閮戒細澶勪簬浠誨姟鏍堢殑鏍堥《銆傛妯″紡涓鑸敤浜庡姞杞借緝鎱㈢殑錛屾瘮杈冭楁ц兘涓斾笉闇瑕佹瘡嬈¢兘閲嶆柊鍒涘緩鐨?/span><span style="line-height: 1.5; font-family: 'Times New Roman'">Activity</span><span style="line-height: 1.5; font-family: 瀹嬩綋">銆?/span></span></p><img src ="http://www.tkk7.com/ZouYonghui/aggbug/425872.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/ZouYonghui/" target="_blank">Terry Zou</a> 2015-06-24 18:10 <a href="http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425872.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>android涓法榪涚▼閫氳鐨?縐嶆柟寮?/title><link>http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425871.html</link><dc:creator>Terry Zou</dc:creator><author>Terry Zou</author><pubDate>Wed, 24 Jun 2015 09:28:00 GMT</pubDate><guid>http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425871.html</guid><wfw:comment>http://www.tkk7.com/ZouYonghui/comments/425871.html</wfw:comment><comments>http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425871.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/ZouYonghui/comments/commentRss/425871.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/ZouYonghui/services/trackbacks/425871.html</trackback:ping><description><![CDATA[     鎽樿: android涓法榪涚▼閫氳鐨?縐嶆柟寮? 杞嚜錛歨ttp://www.cnblogs.com/sevenyuan/archive/2013/03/22/2975122.html鐢變簬android緋葷粺涓簲鐢ㄧ▼搴忎箣闂翠笉鑳藉叡浜唴瀛樸傚洜姝わ紝鍦ㄤ笉鍚屽簲鐢ㄧ▼搴忎箣闂翠氦浜掓暟鎹紙璺ㄨ繘紼嬮氳錛夊氨紼嶅井楹葷儲涓浜涖傚湪android SDK涓彁渚涗簡4縐嶇敤浜庤法榪涚▼閫氳鐨勬柟寮忋傝繖4縐嶆柟寮忔濂藉搴斾簬android緋葷粺涓?縐嶅簲鐢?..  <a href='http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425871.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/ZouYonghui/aggbug/425871.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/ZouYonghui/" target="_blank">Terry Zou</a> 2015-06-24 17:28 <a href="http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425871.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Android 涓涓簲鐢ㄤ腑鍙湁涓涓繘紼嬩箞錛熻繕鏄彲浠ユ湁澶氫釜http://www.tkk7.com/ZouYonghui/archive/2015/06/24/425869.htmlTerry ZouTerry ZouWed, 24 Jun 2015 09:12:00 GMThttp://www.tkk7.com/ZouYonghui/archive/2015/06/24/425869.htmlhttp://www.tkk7.com/ZouYonghui/comments/425869.htmlhttp://www.tkk7.com/ZouYonghui/archive/2015/06/24/425869.html#Feedback0http://www.tkk7.com/ZouYonghui/comments/commentRss/425869.htmlhttp://www.tkk7.com/ZouYonghui/services/trackbacks/425869.htmlAndroid 鎵嬫満涓婄殑搴旂敤涓鑸儏鍐典笅閮藉湪涓涓繘紼嬩腑榪愯銆?/p>

浣嗘槸錛屼篃鍙互鎸囧畾Activity鎴栬匰ervice鍦≧emote 榪涚▼涓墽琛屻傚鏁版儏鍐典笅錛屽彧鏈夊湪鐢ㄦ埛璁や負搴旂敤閫鍑哄悗榪橀渶瑕佺戶緇悗鍙伴暱鏈熻繍琛岀殑搴旂敤錛屾墠闇瑕佽繖鏍峰仛銆傛鏃訛紝璇ュ簲鐢ㄦ湁涓や釜榪涚▼銆?/p>

榪樻湁涓縐峢ack鐨勬柟寮忥紝鍦╝pk涓氳繃璋冪敤鍛戒護琛屾潵鍚姩鍙﹀鐨勮繘紼嬨傛縐嶆柟寮忕敤鎴蜂笉鍙錛屼篃涓嶅畨鍏ㄣ備笉鎻愬°?/p>

Terry Zou 2015-06-24 17:12 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲韩国在线一卡二卡| 亚洲毛片αv无线播放一区| 亚洲美女视频一区| 99热这里有免费国产精品| 亚洲ⅴ国产v天堂a无码二区| 精品国产污污免费网站入口| 亚洲一级片内射网站在线观看| 一区二区3区免费视频| 久久亚洲精品无码播放| 岛国精品一区免费视频在线观看| 亚洲综合在线另类色区奇米| 免费萌白酱国产一区二区三区 | 免费一级毛片无毒不卡| 亚洲高清在线观看| 3d成人免费动漫在线观看| 亚洲国产美女精品久久| 久久精品免费一区二区喷潮| 大桥未久亚洲无av码在线| 亚洲第一网站男人都懂| 中文字幕在线观看免费| 亚洲一区二区三区高清| 免费看国产精品3a黄的视频| 国产亚洲福利一区二区免费看| 伊人久久综在合线亚洲91| 91老湿机福利免费体验| 亚洲中文字幕无码中文| 亚洲免费日韩无码系列| 99在线观看精品免费99| 亚洲6080yy久久无码产自国产| 自拍偷自拍亚洲精品第1页| 51在线视频免费观看视频| 亚洲国产精品自在自线观看| 久久久久亚洲av成人无码电影 | 成人免费a级毛片无码网站入口| 久久综合给合久久国产免费| 亚洲国产精品一区二区久| 四虎永久精品免费观看| 无码成A毛片免费| 菠萝菠萝蜜在线免费视频| 久久精品亚洲一区二区三区浴池 | 毛片无码免费无码播放|