锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲熟妇av一区二区三区,亚洲成a人片在线观看久,亚洲国产精品乱码在线观看97http://m.tkk7.com/gaolei-xj/category/51622.htmlzh-cnMon, 18 Feb 2013 03:56:41 GMTMon, 18 Feb 2013 03:56:41 GMT60 Android涓叧浜庡竷灞鏂囦歡寤惰繜鍔犺澆鎺т歡ViewStubhttp://m.tkk7.com/gaolei-xj/archive/2013/02/17/395348.htmlanthonyanthonySun, 17 Feb 2013 07:41:00 GMThttp://m.tkk7.com/gaolei-xj/archive/2013/02/17/395348.htmlhttp://m.tkk7.com/gaolei-xj/comments/395348.htmlhttp://m.tkk7.com/gaolei-xj/archive/2013/02/17/395348.html#Feedback0http://m.tkk7.com/gaolei-xj/comments/commentRss/395348.htmlhttp://m.tkk7.com/gaolei-xj/services/trackbacks/395348.html
     ViewStub 鏄竴涓笉鍙鐨勶紝澶у皬涓?鐨刅iew錛屾渶浣崇敤閫斿氨鏄疄鐜癡iew鐨勫歡榪熷姞杞斤紝鍦ㄩ渶瑕佺殑鏃跺欏啀鍔犺澆View錛屽彲Java涓父瑙佺殑鎬ц兘浼樺寲鏂規(guī)硶寤惰繜鍔犺澆涓鏍楓?/div>
     褰撹皟鐢╒iewStub鐨剆etVisibility鍑芥暟璁劇疆涓哄彲瑙佹垨鍒欒皟鐢?inflate鍒濆鍖栬View鐨勬椂鍊欙紝ViewStub寮曠敤鐨勮祫婧愬紑濮嬪垵濮嬪寲錛岀劧鍚庡紩鐢ㄧ殑璧勬簮鏇夸唬ViewStub鑷繁鐨勪綅緗~鍏呭湪ViewStub鐨?浣嶇疆銆傚洜姝ゅ湪娌℃湁璋冪敤setVisibility(int) 鎴栧垯 inflate()鍑芥暟涔嬪墠 ViewStub涓縐嶅瓨鍦ㄧ粍浠舵爲(wèi)灞傜駭緇撴瀯涓紝浣嗘槸鐢變簬ViewStub闈炲父杞婚噺綰э紝榪欏鎬ц兘褰卞搷闈炲父灝忋?鍙互閫氳繃ViewStub鐨刬nflatedId灞炴ф潵閲嶆柊瀹氫箟寮曠敤鐨刲ayout id銆?渚嬪錛?br />     
<ViewStub android:id="@+id/stub"
               android:inflatedId
="@+id/subTree"
               android:layout
="@layout/mySubTree"
               android:layout_width
="120dip"
               android:layout_height
="40dip" />
涓婇潰瀹氫箟鐨刅iewStub 錛屽彲浠ラ氳繃id “stub”鏉ユ壘鍒幫紝鍦ㄥ垵濮嬪寲璧勬簮“mySubTree”鍚庯紝stub浠庣埗緇勪歡涓垹闄わ紝鐒跺悗"mySubTree"鏇夸唬stub鐨勪綅緗傚垵濮嬭祫婧?mySubTree"寰楀埌鐨勭粍浠跺彲浠ラ氳繃inflatedId 鎸囧畾鐨刬d "subTree"寮曠敤銆?鐒跺悗鍒濆鍖栧悗鐨勮祫婧愯濉厖鍒頒竴涓?20dip瀹姐?0dip楂樼殑鍦版柟銆?/span>

鎺ㄨ崘浣跨敤涓嬮潰鐨勬柟寮忔潵鍒濆鍖朧iewStub錛?/span>
ViewStub stub = (ViewStub) findViewById(R.id.stub);
     View inflated = stub.inflate();


褰撹皟鐢╥nflate()鍑芥暟鐨勬椂鍊欙紝ViewStub 琚紩鐢ㄧ殑璧勬簮鏇夸唬錛屽茍涓旇繑鍥炲紩鐢ㄧ殑view銆?榪欐牱紼嬪簭鍙互鐩存帴寰楀埌寮曠敤鐨剉iew鑰屼笉鐢ㄥ啀嬈¤皟鐢ㄥ嚱鏁?findViewById()鏉ユ煡鎵句簡銆?/span>


activity_main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools
="http://schemas.android.com/tools"
    android:layout_width
="match_parent"
    android:layout_height
="match_parent"
    android:orientation
="vertical"
    android:paddingBottom
="@dimen/activity_vertical_margin"
    android:paddingLeft
="@dimen/activity_horizontal_margin"
    android:paddingRight
="@dimen/activity_horizontal_margin"
    android:paddingTop
="@dimen/activity_vertical_margin"
    tools:context
=".MainActivity" >

    
<!-- 闈欐佸姞杞藉竷灞鏂囦歡 -->

    
<include
        
android:layout_width="wrap_content"
        android:layout_height
="wrap_content"
        layout
="@layout/my_sub_tree" />

    
<!-- 鍔ㄦ佸姞杞藉竷灞鏂囦歡 -->

    
<ViewStub
        
android:id="@+id/stub"
        android:layout_width
="wrap_content"
        android:layout_height
="wrap_content"
        android:inflatedId
="@+id/subTree"
        android:layout
="@layout/my_sub_tree" />

    
<Button
        
android:id="@+id/button_show"
        android:layout_width
="wrap_content"
        android:layout_height
="wrap_content"
        android:text
="鍔ㄦ佸姞杞藉竷灞" />

    
<Button
        
android:id="@+id/button_hidden"
        android:layout_width
="wrap_content"
        android:layout_height
="wrap_content"
        android:text
="鍔ㄦ侀殣钘忓竷灞" />

</LinearLayout>


my_sub_tree.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width
="match_parent"
    android:layout_height
="match_parent"
    android:orientation
="vertical" >

    
<RatingBar
        
android:id="@+id/ratingBar"
        android:layout_width
="wrap_content"
        android:layout_height
="wrap_content" />

</LinearLayout>

MainActivity.java:
package com.example.android_viewstub;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewStub;
import android.widget.Button;
import android.widget.RatingBar;

/**
 * Demo鎻忚堪: 鍒╃敤ViewStub鏄劇ず鍜岄殣钘忓竷灞 ViewStub鐨勫紩鍏? 鍦ㄥ紑鍙戠殑鏃跺?鏈変簺甯冨眬鏄鏍規(guī)嵁鏉′歡鑰屽姩鎬佹樉紺?杈懼埌涓涓竷灞涓ょ敤鐨勬晥鏋?
 * 榪愮敤View.VISIBLE鍜孷iew.GONE鍘繪敼鍙樺竷灞鐨勫彲瑙佹? 榪欐牱鐨勫仛娉曟樉鐒舵槸娌′粈涔堝澶х殑闂,浼樼偣閫昏緫娓呮櫚,鎺у埗鐏墊椿,浣嗙己鐐瑰氨鏄楄垂璧勬簮
 * 鍦╯etContentView()鎴栬呯敤inflate鍔犺澆甯冨眬鏂囦歡鏃舵棤璁篤iew鏄惁
 * 琚緗負(fù)View.GONE鍜孷iew.VISIBLE,閮戒細(xì)鍒涘緩瀵硅薄,鍗犵敤涓瀹氱▼搴︿笂鐨勫唴瀛?鎵浠ュ湪鑰冭檻浼樺寲紼嬪簭鐨勬椂鍊欙紝
 * 灝介噺閬垮厤璧勬簮嫻垂錛岄檷浣庣▼搴忕殑璧勬簮鍗犳湁閲忥紝鎻愰珮鍝嶅簲閫熷害錛屾彁鍗囪蔣浠剁殑鐢ㄦ埛浣撻獙
 * 
 * 鎺ㄨ崘鐨勫仛娉曟槸浣跨敤android.view.ViewStub. ViewStub鏄竴涓交閲忕駭鐨刅iew,瀹冧竴涓湅涓嶈鐨?涓嶅崰甯冨眬浣嶇疆,鍗犵敤璧勬簮闈炲父灝忕殑鎺т歡.
 * ViewStub鏄竴涓殣钘忕殑,涓嶅崰鐢ㄥ唴瀛樼┖闂寸殑瑙嗗浘瀵硅薄,瀹冨彲浠ュ湪榪愯鏃跺歡榪熷姞杞藉竷灞璧勬簮鏂囦歡褰?nbsp;ViewStub鍙,鎴栬呰皟鐢?br /> * inflate()鍑芥暟鏃?鎵嶄細(xì)鍔犺澆榪欎釜甯冨眬璧勬簮鏂囦歡 娉ㄦ剰鐨勯棶棰? ViewStub鍙兘鐢ㄦ潵Inflate涓涓竷灞鏂囦歡,鑰屼笉鏄煇涓叿浣撶殑View
 * 
 * 閬囧埌鐨勯棶棰? 鎶ラ敊 ViewStub must have a non-null ViewGroup viewParent 鍘熷洜:
 * 瀹樻柟鏂囨。:viewstub涓嶈兘鍙嶅inflate,鍙兘inflate涓嬈?br /> *

 
*/
public class MainActivity extends Activity implements OnClickListener {
    
private ViewStub mViewStub;
    
private Button mShowButton;
    
private Button mHiddenButton;

    @Override
    
protected void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findView();
        bindView();
    }

    
private void findView() {
        mViewStub 
= (ViewStub) this.findViewById(R.id.stub);
        mShowButton 
= (Button) this.findViewById(R.id.button_show);
        mHiddenButton 
= (Button) this.findViewById(R.id.button_hidden);
    }

    
private void bindView() {
        mShowButton.setOnClickListener(
this);
        mHiddenButton.setOnClickListener(
this);
    }

    @Override
    
public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        
return true;
    }

    @Override
    
public void onClick(View v) {
        
switch (v.getId()) {
        
case R.id.button_show:
            View inflated 
= mViewStub.inflate();
            RatingBar ratingBar 
= (RatingBar) inflated
                    .findViewById(R.id.ratingBar);
            ratingBar.setRating(
4);
            
// mViewStub.setVisibility(View.VISIBLE);
            break;
        
case R.id.button_hidden:
            mViewStub.setVisibility(View.GONE);
            
break;
        
default:
            
break;
        }
    }

}




anthony 2013-02-17 15:41 鍙戣〃璇勮
]]>
android 瀹屽叏閫鍑哄簲鐢ㄧ▼搴?/title><link>http://m.tkk7.com/gaolei-xj/archive/2012/12/24/393425.html</link><dc:creator>anthony</dc:creator><author>anthony</author><pubDate>Mon, 24 Dec 2012 15:11:00 GMT</pubDate><guid>http://m.tkk7.com/gaolei-xj/archive/2012/12/24/393425.html</guid><wfw:comment>http://m.tkk7.com/gaolei-xj/comments/393425.html</wfw:comment><comments>http://m.tkk7.com/gaolei-xj/archive/2012/12/24/393425.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/gaolei-xj/comments/commentRss/393425.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/gaolei-xj/services/trackbacks/393425.html</trackback:ping><description><![CDATA[<div><p style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">      android紼嬪簭涓鏋滄湁寰堝activity錛屽張娌℃湁鍦ㄨ煩杞繃紼嬩腑鍏ㄩ兘finish錛屽緢鍙兘鍦ㄦ渶鍚庨鍑虹▼搴忔椂錛屽綋鍓嶇殑activity緇撴潫浜嗭紝浣嗘槸鍙?璺寵漿鍒癮ctivity鏍堢殑涓嬩竴涓猘ctivity銆備緥濡備粠A-B-C,鍦ㄨ煩杞繃紼嬩腑娌℃湁finish鎺塀錛岄偅涔堜粠C閫鍑虹▼搴忔椂錛屽氨浼?xì)锜╁埌B鐨勭晫闈€?/p><p style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br /></p><p style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">      鏈鐞嗘兂鐨勮В鍐沖姙娉曞氨鏄瘡嬈″湪璋冪敤startActivity(intent)涔嬪墠finish褰撳墠鐨刟ctivity錛屼絾鏄鏋滃湪涓嬩竴涓猘ctivity 鍙堣鍥炲埌涓婁竴涓猘ctivity錛屽氨闇瑕乶ew涓涓柊鐨刟ctivity浜嗐傚鏋滃垰濂借繖涓猘ctivity闇瑕佸姞杞藉緢澶氬浘鐗囧拰淇℃伅錛屼緥濡備竴涓?listactivity鎴栬呭惈鏈変竴涓猤allery錛岄偅涔堢敤鎴蜂綋楠屾у氨寰堝樊錛屾瘡嬈℃寜榪斿洖閿兘瑕侀噸鏂板姞杞姐傞偅涔堟湁娌″姙娉曡В鍐沖畬鍏ㄩ鍑虹▼搴忕殑鏂規(guī)硶錛屽悓鏃跺張鑳?淇濊瘉鐢ㄦ埛浣撻獙鎬у憿錛?/p><p style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><br /></p><p style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">       緗戜笂姣旇緝嫻佽鐨勬柟娉曟槸瀹氫箟鏍堬紝鍐欎竴涓狤xitApplication綾伙紝鍒╃敤鍗曚緥妯″紡綆$悊Activity錛屽湪姣忎釜鍦ˋctivity鐨?onCreate()鏂規(guī)硶涓皟鐢‥xitApplication.getInstance().addActivity(this)鏂規(guī)硶,鍦ㄩ鍑烘椂璋冪敤 ExitApplication.getInstance().exit()鏂規(guī)硶錛屽氨鍙互瀹屽叏閫鍑哄簲鐢ㄧ▼搴忎簡銆?/p></div> <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 />--><span style="color: #008080; "> 1</span> <span style="color: #0000FF; ">package</span><span style="color: #000000; "> com.gaolei.study;<br /></span><span style="color: #008080; "> 2</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 3</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.util.LinkedList;<br /></span><span style="color: #008080; "> 4</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.util.List;<br /></span><span style="color: #008080; "> 5</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 6</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> android.app.Activity;<br /></span><span style="color: #008080; "> 7</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> android.app.Application;<br /></span><span style="color: #008080; "> 8</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 9</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> MyApplication </span><span style="color: #0000FF; ">extends</span><span style="color: #000000; "> Application {<br /></span><span style="color: #008080; ">10</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">11</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> MyApplication instance;<br /></span><span style="color: #008080; ">12</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">13</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> List</span><span style="color: #000000; "><</span><span style="color: #000000; ">Activity</span><span style="color: #000000; ">></span><span style="color: #000000; "> activityList </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> LinkedList</span><span style="color: #000000; "><</span><span style="color: #000000; ">Activity</span><span style="color: #000000; ">></span><span style="color: #000000; ">();<br /></span><span style="color: #008080; ">14</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">15</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> MyApplication() {<br /></span><span style="color: #008080; ">16</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; ">17</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">18</span> <span style="color: #000000; ">    </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 鍗曚緥妯″紡鑾峰彇鍞竴鐨凪yApplication瀹炰緥</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">19</span> <span style="color: #008000; "></span><span style="color: #000000; ">    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> MyApplication getInstance() {<br /></span><span style="color: #008080; ">20</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (</span><span style="color: #0000FF; ">null</span><span style="color: #000000; "> </span><span style="color: #000000; ">==</span><span style="color: #000000; "> instance) {<br /></span><span style="color: #008080; ">21</span> <span style="color: #000000; ">            instance </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> MyApplication();<br /></span><span style="color: #008080; ">22</span> <span style="color: #000000; ">        }<br /></span><span style="color: #008080; ">23</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> instance;<br /></span><span style="color: #008080; ">24</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; ">25</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">26</span> <span style="color: #000000; ">    </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 娣誨姞Activity鍒板鍣ㄤ腑</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">27</span> <span style="color: #008000; "></span><span style="color: #000000; ">    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> addActivity(Activity activity) {<br /></span><span style="color: #008080; ">28</span> <span style="color: #000000; ">        activityList.add(activity);<br /></span><span style="color: #008080; ">29</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; ">30</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">31</span> <span style="color: #000000; ">    </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 閬嶅巻鎵鏈堿ctivity騫秄inish</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">32</span> <span style="color: #008000; "></span><span style="color: #000000; ">    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> exit() {<br /></span><span style="color: #008080; ">33</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (Activity activity : activityList) {<br /></span><span style="color: #008080; ">34</span> <span style="color: #000000; ">            activity.finish();<br /></span><span style="color: #008080; ">35</span> <span style="color: #000000; ">        }<br /></span><span style="color: #008080; ">36</span> <span style="color: #000000; ">        System.exit(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">37</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; ">38</span> <span style="color: #000000; ">}<br /></span><span style="color: #008080; ">39</span> <span style="color: #000000; "></span></div>        <div><div style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">        姣忎釜Activity綾諱腑onCreate()鏂規(guī)硶涓皟鐢?ExitApplication.getInstance().addActivity(Activity activity)鏂規(guī)硶銆傚湪鏌愪竴涓狝ctivity鐣岄潰閫鍑哄簲鐢ㄧ▼搴忔椂錛屽彧瑕佽皟鐢?ExitApplication.getInstance().exit()鏂規(guī)硶錛屽氨鍙互鍦ㄥ畬鍏ㄩ鍑哄簲鐢ㄧ▼搴忋?/div><div style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "></div><div style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">褰撶劧涔熷彲浠ュ啓涓涓狟aseActivity緇ф壙Activity, 閲嶅啓onCreate()鏂規(guī)硶,鐒跺悗鎵鏈塧ctivity閮界戶鎵垮畠銆?/div></div><img src ="http://m.tkk7.com/gaolei-xj/aggbug/393425.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/gaolei-xj/" target="_blank">anthony</a> 2012-12-24 23:11 <a href="http://m.tkk7.com/gaolei-xj/archive/2012/12/24/393425.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title> android瀹炵幇杈規(guī)鍦嗚http://m.tkk7.com/gaolei-xj/archive/2012/12/19/393231.htmlanthonyanthonyWed, 19 Dec 2012 15:51:00 GMThttp://m.tkk7.com/gaolei-xj/archive/2012/12/19/393231.htmlhttp://m.tkk7.com/gaolei-xj/comments/393231.htmlhttp://m.tkk7.com/gaolei-xj/archive/2012/12/19/393231.html#Feedback0http://m.tkk7.com/gaolei-xj/comments/commentRss/393231.htmlhttp://m.tkk7.com/gaolei-xj/services/trackbacks/393231.html

1. 鍦╠rawable 涓嬫柊寤?shape.xml 鏂囦歡

Xml浠g爜  :
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <shape xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:shape="rectangle" >
 4 
 5     <!-- 濉厖鐨勯鑹?nbsp;-->
 6     <solid android:color="#FFFFFF" />
 7     <!-- 璁劇疆鐭╁艦鐨勫洓涓涓哄姬褰?nbsp;-->
 8     <!-- android:radius 寮у艦鐨勫崐寰?nbsp;-->
 9     <corners android:radius="7dip" />
10 
11 </shape>

 android:radius涓鴻鐨勫姬搴︼紝鍊艱秺澶ц瓚婂渾銆?/p>鎴戜滑榪樺彲浠ユ妸鍥涗釜瑙掕瀹氭垚涓嶅悓鐨勮搴︼紝鏂規(guī)硶涓猴細(xì)
 

1 <corners
2         android:bottomLeftRadius="20dp"
3         android:bottomRightRadius="0dp"
4         android:topLeftRadius="1dp"
5         android:topRightRadius="20dp" />


2.1璁劇疆鎴?dp鏃犳晥錛?.1浠ヤ笂鐗堟湰鍙互錛屽鏋滄棤鏁堢殑璇濋偅灝卞彧鑳借鎴?dp浜嗐?nbsp;


2.璁劇疆寮曠敤

     android:background="@drawable/shape"

 

EditText 鍏跺畠灞炴?/em>

        android:hint="璇瘋緭鍏ョ敤鎴峰悕" <!-- 璁劇疆鎻愮ず鏂囨湰 -->
        android:drawableLeft="@drawable/ic_launcher" <!-- 璁劇疆鏂囨湰妗嗗乏杈瑰皬鍥炬爣 -->

渚嬪瓙:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="fill_parent"
 4     android:layout_height="fill_parent"
 5     android:orientation="vertical" >
 6 
 7     <EditText
 8         android:layout_width="fill_parent"
 9         android:layout_height="wrap_content"
10         android:background="@drawable/shape"
11         android:drawableLeft="@drawable/ic_launcher"
12         android:drawablePadding="5dp"
13         android:hint="Hello Android"
14         android:padding="5dp" />
15 
16 </LinearLayout>


 



anthony 2012-12-19 23:51 鍙戣〃璇勮
]]>
Eclipse浼樺寲http://m.tkk7.com/gaolei-xj/archive/2012/12/19/393230.htmlanthonyanthonyWed, 19 Dec 2012 15:13:00 GMThttp://m.tkk7.com/gaolei-xj/archive/2012/12/19/393230.htmlhttp://m.tkk7.com/gaolei-xj/comments/393230.htmlhttp://m.tkk7.com/gaolei-xj/archive/2012/12/19/393230.html#Feedback0http://m.tkk7.com/gaolei-xj/comments/commentRss/393230.htmlhttp://m.tkk7.com/gaolei-xj/services/trackbacks/393230.html

1. 鍙栨秷緋葷粺鐨勮嚜鍔ㄦ姌鍙?/span>

Window->Preferences-> Java->Editor->Folding: Enable folding

2. 鍙栨秷鎸?."鍚庤嚜鍔ㄦ縺媧繪彁紺哄姛鑳姐傝繖鏍蜂細(xì)鏈変簺鎻愰珮閫熷害

Window->Preferences-> Java->Editor->Content Assist: Enable auto activation

3. 鍏抽棴涓嶅父鐢ㄧ殑宸ョ▼
涓浜涗笉甯哥敤鐨勫伐紼嬫墦寮鐨勬椂鍊欙紝涔熶細(xì)褰卞搷浣犳鍦ㄤ嬌鐢ㄥ伐紼嬬殑鎿嶄綔閫熷害銆?br />
4. 璁劇疆鍚姩鍙傛暟
璧峰姩鐨勬椂鍊?鍔犱笂鍙傛暟錛?strong style="color: black; background-color: #ffff66;">eclipse.exe -vmargs -Xverify:none -XX:+UseParallelGC -XX:PermSize=20M
-Xms64M -
Xmx200M
濡傛灉浣犵殑鍐呭瓨鏄?G鐨勩傚彲浠ュ皢鏈鍚庝竴涓弬鏁癤mx200M鏀逛負(fù)
Xmx512M
榪欎釜鍦ㄤ綘鐨勮搗鍔ㄥ揩鎹烽敭鐨勫睘鎬ч噷璁劇疆銆?/span>

6. 鍙栨秷Plugin
榪涘叆Preferences鎶奝lug-in Development>Target Platform>
plug-in閲岃窡鑷繁鏃犲叧鎴栬呮殏涓斾笉鐢ㄧ殑plug
-in鍘繪帀鍕鵑夛紝鎴戣繖閲屽叡400澶氫釜涓幓鎺変簡100澶氫釜銆?br />
7. 璁劇疆Edit Mode
MyEclipse5.0.1GA_E3.2 涔嬪墠鐨勶細(xì)Window->Preferences->-->myeclipse->files & Editors涓嬫妸璺熺紪杈戞湁鍏崇殑鎵鏈?br />鐨凟dit Modes 璁句負(fù)
Disable Design Mode

8. 璁劇疆瑙嗗浘
鎵撳紑Customize Perspective閲岃嚜宸辨病鐢ㄥ埌鐨勯夐」鑷繁鍘繪帀鍕鵑夈?/span>

5. 鍙栨秷MyEclipse鍦ㄥ惎鍔ㄦ椂鑷姩楠岃瘉欏圭洰閰嶇疆鏂囦歡
榛樿鎯呭喌涓婱yEclipse鍦ㄥ惎鍔ㄧ殑鏃跺欎細(xì)鑷姩楠岃瘉姣忎釜欏圭洰鐨勯厤緗枃浠訛紝榪欐槸 涓涓潪甯歌楁椂鐨勮繃紼嬶紝鍙互鍦≒references紿楀彛渚濇閫夋嫨MyEclipse - Validation錛岀劧鍚庡湪鍙充晶鐨刅alidator鍒楄〃涓彧淇濈暀 Manual 欏瑰氨鍙互浜嗐傚鏋滈渶瑕侀獙璇佺殑鏃跺欏彧闇瑕侀変腑鏂囦歡錛岀劧鍚庡彸閿夋嫨 MyEclipse - Run Validation灝卞彲浠ヤ簡銆?/p>

9. 鍘婚櫎涓嶉渶瑕佸姞杞界殑妯″潡
涓涓郴緇?0%鐨勫姛鑳藉線寰鑳藉婊¤凍80%鐨勯渶姹傦紝MyEclipse涔熶笉渚嬪錛屾垜浠湪澶у鏁版椂鍊欏彧闇瑕?0%鐨?緋葷粺鍔熻兘錛屾墍浠ュ彲浠ュ皢涓浜涗笉浣跨敤鐨勬ā鍧楃姝㈠姞杞藉惎鍔ㄣ傞氳繃Windows - Preferences鎵撳紑閰嶇疆紿楀彛錛屼緷嬈¢夋嫨宸︿晶鐨凣eneral - Startup and Shutdown錛岃繖涓椂鍊欏湪鍙充晶灝辨樉紺哄嚭浜咵clipse鍚姩鏃跺姞杞界殑妯″潡錛屽彲浠ユ牴鎹嚜宸辯殑瀹為檯鎯呭喌鍘婚櫎涓浜涙ā鍧椼?/p>



anthony 2012-12-19 23:13 鍙戣〃璇勮
]]>
Android寮鍙戜箣Eclipse蹇嵎閿ぇ鍏?/title><link>http://m.tkk7.com/gaolei-xj/archive/2012/09/17/387875.html</link><dc:creator>anthony</dc:creator><author>anthony</author><pubDate>Mon, 17 Sep 2012 03:11:00 GMT</pubDate><guid>http://m.tkk7.com/gaolei-xj/archive/2012/09/17/387875.html</guid><wfw:comment>http://m.tkk7.com/gaolei-xj/comments/387875.html</wfw:comment><comments>http://m.tkk7.com/gaolei-xj/archive/2012/09/17/387875.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/gaolei-xj/comments/commentRss/387875.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/gaolei-xj/services/trackbacks/387875.html</trackback:ping><description><![CDATA[     鎽樿: Ctrl+1 蹇熶慨澶?鏈緇忓吀鐨勫揩鎹烽敭,灝變笉鐢ㄥ璇翠簡)Ctrl+D: 鍒犻櫎褰撳墠琛?nbsp;Ctrl+Alt+↓ 澶嶅埗褰撳墠琛屽埌涓嬩竴琛?澶嶅埗澧炲姞)Ctrl+Alt+↑ 澶嶅埗褰撳墠琛屽埌涓婁竴琛?澶嶅埗澧炲姞)Alt+↓ 褰撳墠琛屽拰涓嬮潰涓琛屼氦浜掍綅緗?鐗瑰埆瀹炵敤,鍙互鐪佸幓鍏堝壀鍒?鍐嶇矘璐翠簡)Alt+↑ 褰撳墠琛屽拰涓婇潰涓琛屼氦浜掍綅緗?鍚屼笂)Alt+← 鍓嶄竴涓紪杈戠殑欏?..  <a href='http://m.tkk7.com/gaolei-xj/archive/2012/09/17/387875.html'>闃呰鍏ㄦ枃</a><img src ="http://m.tkk7.com/gaolei-xj/aggbug/387875.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/gaolei-xj/" target="_blank">anthony</a> 2012-09-17 11:11 <a href="http://m.tkk7.com/gaolei-xj/archive/2012/09/17/387875.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓哄簲鐢ㄦ坊鍔犲涓狝ctivity涓庡弬鏁頒紶閫?/title><link>http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378550.html</link><dc:creator>anthony</dc:creator><author>anthony</author><pubDate>Sat, 19 May 2012 02:50:00 GMT</pubDate><guid>http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378550.html</guid><wfw:comment>http://m.tkk7.com/gaolei-xj/comments/378550.html</wfw:comment><comments>http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378550.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/gaolei-xj/comments/commentRss/378550.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/gaolei-xj/services/trackbacks/378550.html</trackback:ping><description><![CDATA[     鎽樿:   <a href='http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378550.html'>闃呰鍏ㄦ枃</a><img src ="http://m.tkk7.com/gaolei-xj/aggbug/378550.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/gaolei-xj/" target="_blank">anthony</a> 2012-05-19 10:50 <a href="http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378550.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鏂囦歡鏂偣涓婁紶鍣?/title><link>http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378542.html</link><dc:creator>anthony</dc:creator><author>anthony</author><pubDate>Sat, 19 May 2012 01:21:00 GMT</pubDate><guid>http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378542.html</guid><wfw:comment>http://m.tkk7.com/gaolei-xj/comments/378542.html</wfw:comment><comments>http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378542.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/gaolei-xj/comments/commentRss/378542.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/gaolei-xj/services/trackbacks/378542.html</trackback:ping><description><![CDATA[<div><div style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">       鍦ˋndroid涓笂浼犳枃浠跺彲浠ラ噰鐢℉TTP鏂瑰紡錛屼篃鍙互閲囩敤Socket鏂瑰紡錛屼絾鏄疕TTP鏂瑰紡涓嶈兘涓婁紶澶ф枃浠訛紝榪欓噷浠嬬粛涓縐嶉氳繃Socket鏂瑰紡鏉ヨ繘琛屾柇鐐圭畫浼犵殑鏂瑰紡錛屾湇鍔$浼?xì)璁板綍涓嬫枃錃g鐨勪笂浼犺繘搴︼紝褰撴煇涓嬈′笂浼犺繃紼嬫剰澶栫粓姝㈠悗錛屼笅涓嬈″彲浠ョ戶緇笂浼狅紝榪欓噷鐢ㄥ埌鐨勫叾瀹炶繕鏄疛2SE閲岀殑鐭ヨ瘑銆?/div><div style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">      榪欎釜涓婁紶紼嬪簭鐨勫師鐞嗘槸錛氬鎴風(fēng)絎竴嬈′笂浼犳椂鍚戞湇鍔$鍙戦?#8220;Content-Length=35;filename=WinRAR_3.90_SC.exe;sourceid=“榪欑鏍煎紡鐨勫瓧絎︿覆錛屾湇鍔$鏀跺埌鍚庝細(xì)鏌ユ壘璇ユ枃浠舵槸鍚︽湁涓婁紶璁板綍錛屽鏋滄湁灝辮繑鍥炲凡緇忎笂浼犵殑浣嶇疆錛屽惁鍒欒繑鍥炴柊鐢熸垚鐨剆ourceid浠ュ強position涓?錛岀被浼?#8221;sourceid=2324838389;position=0“榪欐牱鐨勫瓧絎︿覆錛屽鎴風(fēng)鏀跺埌榪斿洖鍚庣殑瀛楃涓插悗鍐嶄粠鎸囧畾鐨勪綅緗紑濮嬩笂浼犳枃浠躲?/div></div><img src ="http://m.tkk7.com/gaolei-xj/aggbug/378542.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/gaolei-xj/" target="_blank">anthony</a> 2012-05-19 09:21 <a href="http://m.tkk7.com/gaolei-xj/archive/2012/05/19/378542.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>澶氱嚎紼嬫柇鐐逛笅杞藉櫒http://m.tkk7.com/gaolei-xj/archive/2012/05/18/378527.htmlanthonyanthonyFri, 18 May 2012 14:15:00 GMThttp://m.tkk7.com/gaolei-xj/archive/2012/05/18/378527.htmlhttp://m.tkk7.com/gaolei-xj/comments/378527.htmlhttp://m.tkk7.com/gaolei-xj/archive/2012/05/18/378527.html#Feedback1http://m.tkk7.com/gaolei-xj/comments/commentRss/378527.htmlhttp://m.tkk7.com/gaolei-xj/services/trackbacks/378527.html闃呰鍏ㄦ枃

anthony 2012-05-18 22:15 鍙戣〃璇勮
]]>
澶氱嚎紼嬩笅杞藉師鐞?/title><link>http://m.tkk7.com/gaolei-xj/archive/2012/05/17/378442.html</link><dc:creator>anthony</dc:creator><author>anthony</author><pubDate>Thu, 17 May 2012 12:55:00 GMT</pubDate><guid>http://m.tkk7.com/gaolei-xj/archive/2012/05/17/378442.html</guid><wfw:comment>http://m.tkk7.com/gaolei-xj/comments/378442.html</wfw:comment><comments>http://m.tkk7.com/gaolei-xj/archive/2012/05/17/378442.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/gaolei-xj/comments/commentRss/378442.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/gaolei-xj/services/trackbacks/378442.html</trackback:ping><description><![CDATA[<div>     鍩烘湰鍘熺悊錛氬埄鐢℉ttpsURLConnection鑾峰彇瑕佷笅杞芥枃浠剁殑闀垮害銆佸ご閮ㄧ瓑鐩稿叧淇℃伅錛屽茍璁劇疆鍝嶅簲鐨勫ご閮ㄤ俊鎭傚茍涓旈氳繃HttpsURLConnection鑾峰彇杈撳叆嫻侊紝灝嗘枃浠跺垎鎴愭寚瀹氱殑鍧楋紝姣忎竴鍧楀崟鐙紑杈熶竴涓嚎紼嬪畬鎴愭暟鎹殑璇誨彇銆佸啓鍏ャ傞氳繃杈撳叆嫻佽鍙栦笅杞芥枃浠剁殑淇℃伅錛岀劧鍚庡皢璇誨彇鐨勪俊鎭敤RandomAccessFile闅忔満鍐欏叆鍒版湰鍦版枃浠朵腑銆傚悓鏃訛紝姣忎釜綰跨▼鍐欏叆鐨勬暟鎹兘鏂囦歡鎸囬拡涔熷氨鏄啓鍏ユ暟鎹殑闀垮害錛岄渶瑕佷繚瀛樺湪涓涓復(fù)鏃舵枃浠朵腑銆傝繖鏍峰綋鏈涓嬭澆娌℃湁瀹屾垚鐨勬椂鍊欙紝涓嬫涓嬭澆鐨勬椂鍊欏氨浠庤繖涓枃浠朵腑璇誨彇涓婁竴嬈′笅杞界殑鏂囦歡闀垮害錛岀劧鍚庣戶緇帴鐫涓婁竴嬈$殑浣嶇疆寮濮嬩笅杞姐傚茍涓斿皢鏈涓嬭澆鐨勯暱搴﹀啓鍏ュ埌榪欎釜鏂囦歡涓?br /><br /><div><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 />--><span style="color: #008080; "> 1</span> <span style="color: #0000FF; ">package</span><span style="color: #000000; "> com.gaolei.download;<br /></span><span style="color: #008080; "> 2</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 3</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.io.File;<br /></span><span style="color: #008080; "> 4</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.io.IOException;<br /></span><span style="color: #008080; "> 5</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.io.InputStream;<br /></span><span style="color: #008080; "> 6</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.io.RandomAccessFile;<br /></span><span style="color: #008080; "> 7</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> java.net.URL;<br /></span><span style="color: #008080; "> 8</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 9</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">import</span><span style="color: #000000; "> javax.net.ssl.HttpsURLConnection;<br /></span><span style="color: #008080; ">10</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">11</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> MulThreadDownload {<br /></span><span style="color: #008080; ">12</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">13</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> main(String[] args) </span><span style="color: #0000FF; ">throws</span><span style="color: #000000; "> Exception {<br /></span><span style="color: #008080; ">14</span> <span style="color: #000000; ">        String path </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">"</span><span style="color: #000000; ">http://192.168.0.1/videonews/QQWubiSetup.exe</span><span style="color: #000000; ">"</span><span style="color: #000000; ">;<br /></span><span style="color: #008080; ">15</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> MulThreadDownload().download(path, </span><span style="color: #000000; ">3</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">16</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; ">17</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">18</span> <span style="color: #000000; ">    </span><span style="color: #008000; ">/**</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">19</span> <span style="color: #008000; ">     * 涓嬭澆鏂囦歡<br /></span><span style="color: #008080; ">20</span> <span style="color: #008000; ">     *<br /></span><span style="color: #008080; ">21</span> <span style="color: #008000; ">     * </span><span style="color: #808080; ">@param</span><span style="color: #008000; "> path緗戠粶鏂囦歡璺緞<br /></span><span style="color: #008080; ">22</span> <span style="color: #008000; ">     * </span><span style="color: #808080; ">@throws</span><span style="color: #008000; "> Exception<br /></span><span style="color: #008080; ">23</span> <span style="color: #008000; ">     </span><span style="color: #008000; ">*/</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">24</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> download(String path, </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> threadsize) </span><span style="color: #0000FF; ">throws</span><span style="color: #000000; "> Exception {<br /></span><span style="color: #008080; ">25</span> <span style="color: #000000; ">        URL url </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> URL(path);<br /></span><span style="color: #008080; ">26</span> <span style="color: #000000; ">        HttpsURLConnection conn </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (HttpsURLConnection) url.openConnection();<br /></span><span style="color: #008080; ">27</span> <span style="color: #000000; ">        conn.setConnectTimeout(</span><span style="color: #000000; ">5000</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">28</span> <span style="color: #000000; ">        conn.setRequestMethod(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">GET</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">29</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (conn.getResponseCode() </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">200</span><span style="color: #000000; ">) {<br /></span><span style="color: #008080; ">30</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> length </span><span style="color: #000000; ">=</span><span style="color: #000000; "> conn.getContentLength(); </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 鑾峰彇緗戠粶鏂囦歡鐨勯暱搴?/span><span style="color: #008000; "><br /></span><span style="color: #008080; ">31</span> <span style="color: #008000; "></span><span style="color: #000000; ">            File file </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> File(getFilename(path));<br /></span><span style="color: #008080; ">32</span> <span style="color: #000000; ">            RandomAccessFile accessFile </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> RandomAccessFile(file, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">rwd</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);</span><span style="color: #008000; ">//</span><span style="color: #008000; "> 鍦ㄦ湰鍦扮敓鎴愪竴涓暱搴︾浉絳夌殑鏂囦歡</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">33</span> <span style="color: #008000; "></span><span style="color: #000000; ">            accessFile.setLength(length);<br /></span><span style="color: #008080; ">34</span> <span style="color: #000000; ">            accessFile.close();<br /></span><span style="color: #008080; ">35</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">36</span> <span style="color: #000000; ">            </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 璁$畻姣忔潯綰跨▼璐熻矗涓嬭澆鐨勬暟鎹噺</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">37</span> <span style="color: #008000; "></span><span style="color: #000000; ">            </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> block </span><span style="color: #000000; ">=</span><span style="color: #000000; "> length </span><span style="color: #000000; ">%</span><span style="color: #000000; "> threadsize </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; "> </span><span style="color: #000000; ">?</span><span style="color: #000000; "> length </span><span style="color: #000000; ">/</span><span style="color: #000000; "> threadsize : length<br /></span><span style="color: #008080; ">38</span> <span style="color: #000000; ">                    </span><span style="color: #000000; ">/</span><span style="color: #000000; "> threadsize </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br /></span><span style="color: #008080; ">39</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> threadid </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">; threadid </span><span style="color: #000000; "><</span><span style="color: #000000; "> threadsize; threadid</span><span style="color: #000000; ">++</span><span style="color: #000000; ">) {<br /></span><span style="color: #008080; ">40</span> <span style="color: #000000; ">                </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> DownloadThread(threadid, block, url, file).start();<br /></span><span style="color: #008080; ">41</span> <span style="color: #000000; ">            }<br /></span><span style="color: #008080; ">42</span> <span style="color: #000000; ">        } </span><span style="color: #0000FF; ">else</span><span style="color: #000000; "> {<br /></span><span style="color: #008080; ">43</span> <span style="color: #000000; ">            System.out.println(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">涓嬭澆澶辮觸錛?/span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">44</span> <span style="color: #000000; ">        }<br /></span><span style="color: #008080; ">45</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">46</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; ">47</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">48</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> DownloadThread </span><span style="color: #0000FF; ">extends</span><span style="color: #000000; "> Thread {<br /></span><span style="color: #008080; ">49</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">50</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> threadid;<br /></span><span style="color: #008080; ">51</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> block;<br /></span><span style="color: #008080; ">52</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> URL url;<br /></span><span style="color: #008080; ">53</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> File file;<br /></span><span style="color: #008080; ">54</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">55</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> DownloadThread(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> threadid, </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> block, URL url, File file) {<br /></span><span style="color: #008080; ">56</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.threadid </span><span style="color: #000000; ">=</span><span style="color: #000000; "> threadid;<br /></span><span style="color: #008080; ">57</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.block </span><span style="color: #000000; ">=</span><span style="color: #000000; "> block;<br /></span><span style="color: #008080; ">58</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.url </span><span style="color: #000000; ">=</span><span style="color: #000000; "> url;<br /></span><span style="color: #008080; ">59</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.file </span><span style="color: #000000; ">=</span><span style="color: #000000; "> file;<br /></span><span style="color: #008080; ">60</span> <span style="color: #000000; ">        }<br /></span><span style="color: #008080; ">61</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">62</span> <span style="color: #000000; ">        @Override<br /></span><span style="color: #008080; ">63</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">public</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> run() {<br /></span><span style="color: #008080; ">64</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> start </span><span style="color: #000000; ">=</span><span style="color: #000000; "> threadid </span><span style="color: #000000; ">*</span><span style="color: #000000; "> block; </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 璁$畻璇ョ嚎紼嬩粠緗戠粶鏂囦歡鐨勪粈涔堜綅緗紑濮嬩笅杞?/span><span style="color: #008000; "><br /></span><span style="color: #008080; ">65</span> <span style="color: #008000; "></span><span style="color: #000000; ">            </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> end </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (threadid </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">) </span><span style="color: #000000; ">*</span><span style="color: #000000; "> block </span><span style="color: #000000; ">-</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">; </span><span style="color: #008000; ">//</span><span style="color: #008000; "> 涓嬭澆鍒扮綉緇滄枃浠剁殑浠涔堜綅緗粨鏉?/span><span style="color: #008000; "><br /></span><span style="color: #008080; ">66</span> <span style="color: #008000; "></span><span style="color: #000000; "><br /></span><span style="color: #008080; ">67</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">try</span><span style="color: #000000; "> {<br /></span><span style="color: #008080; ">68</span> <span style="color: #000000; ">                RandomAccessFile accessFile </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> RandomAccessFile(file, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">rwd</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);</span><span style="color: #008000; ">//</span><span style="color: #008000; "> 鍦ㄦ湰鍦扮敓鎴愪竴涓暱搴︾浉絳夌殑鏂囦歡</span><span style="color: #008000; "><br /></span><span style="color: #008080; ">69</span> <span style="color: #008000; "></span><span style="color: #000000; ">                accessFile.seek(start);<br /></span><span style="color: #008080; ">70</span> <span style="color: #000000; ">                HttpsURLConnection conn </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (HttpsURLConnection) url<br /></span><span style="color: #008080; ">71</span> <span style="color: #000000; ">                        .openConnection();<br /></span><span style="color: #008080; ">72</span> <span style="color: #000000; ">                conn.setConnectTimeout(</span><span style="color: #000000; ">5000</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">73</span> <span style="color: #000000; ">                conn.setRequestMethod(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">GET</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">74</span> <span style="color: #000000; ">                conn.setRequestProperty(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">Range</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">bytes=</span><span style="color: #000000; ">"</span><span style="color: #000000; "> </span><span style="color: #000000; ">+</span><span style="color: #000000; "> start </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">"</span><span style="color: #000000; ">-</span><span style="color: #000000; ">"</span><span style="color: #000000; "> </span><span style="color: #000000; ">+</span><span style="color: #000000; "> end);<br /></span><span style="color: #008080; ">75</span> <span style="color: #000000; ">                </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (conn.getResponseCode() </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">206</span><span style="color: #000000; ">) {<br /></span><span style="color: #008080; ">76</span> <span style="color: #000000; ">                    InputStream inStream </span><span style="color: #000000; ">=</span><span style="color: #000000; "> conn.getInputStream();<br /></span><span style="color: #008080; ">77</span> <span style="color: #000000; ">                    </span><span style="color: #0000FF; ">byte</span><span style="color: #000000; ">[] buffer </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">byte</span><span style="color: #000000; ">[</span><span style="color: #000000; ">1024</span><span style="color: #000000; ">];<br /></span><span style="color: #008080; ">78</span> <span style="color: #000000; ">                    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> len </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /></span><span style="color: #008080; ">79</span> <span style="color: #000000; ">                    </span><span style="color: #0000FF; ">while</span><span style="color: #000000; "> ((len </span><span style="color: #000000; ">=</span><span style="color: #000000; "> inStream.read(buffer)) </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">) {<br /></span><span style="color: #008080; ">80</span> <span style="color: #000000; ">                        accessFile.write(buffer, </span><span style="color: #000000; ">0</span><span style="color: #000000; ">, len);<br /></span><span style="color: #008080; ">81</span> <span style="color: #000000; ">                    }<br /></span><span style="color: #008080; ">82</span> <span style="color: #000000; ">                    accessFile.close();<br /></span><span style="color: #008080; ">83</span> <span style="color: #000000; ">                    inStream.close();<br /></span><span style="color: #008080; ">84</span> <span style="color: #000000; ">                }<br /></span><span style="color: #008080; ">85</span> <span style="color: #000000; ">                System.out.println(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">絎?/span><span style="color: #000000; ">"</span><span style="color: #000000; "> </span><span style="color: #000000; ">+</span><span style="color: #000000; "> (threadid </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">) </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">"</span><span style="color: #000000; ">鏉$嚎紼嬪凡緇忎笅杞藉畬鎴愶紒</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">86</span> <span style="color: #000000; ">            } </span><span style="color: #0000FF; ">catch</span><span style="color: #000000; "> (IOException e) {<br /></span><span style="color: #008080; ">87</span> <span style="color: #000000; ">                e.printStackTrace();<br /></span><span style="color: #008080; ">88</span> <span style="color: #000000; ">            }<br /></span><span style="color: #008080; ">89</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">90</span> <span style="color: #000000; ">        }<br /></span><span style="color: #008080; ">91</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">92</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; ">93</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">94</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> String getFilename(String path) {<br /></span><span style="color: #008080; ">95</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> path.substring(path.lastIndexOf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">/</span><span style="color: #000000; ">"</span><span style="color: #000000; ">) </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">96</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; ">97</span> <span style="color: #000000; ">}<br /></span><span style="color: #008080; ">98</span> <span style="color: #000000; "></span></div></div></div><img src ="http://m.tkk7.com/gaolei-xj/aggbug/378442.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/gaolei-xj/" target="_blank">anthony</a> 2012-05-17 20:55 <a href="http://m.tkk7.com/gaolei-xj/archive/2012/05/17/378442.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍦⊿QLite涓嬌鐢ㄤ簨鍔?/title><link>http://m.tkk7.com/gaolei-xj/archive/2012/05/16/378340.html</link><dc:creator>anthony</dc:creator><author>anthony</author><pubDate>Wed, 16 May 2012 13:00:00 GMT</pubDate><guid>http://m.tkk7.com/gaolei-xj/archive/2012/05/16/378340.html</guid><wfw:comment>http://m.tkk7.com/gaolei-xj/comments/378340.html</wfw:comment><comments>http://m.tkk7.com/gaolei-xj/archive/2012/05/16/378340.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/gaolei-xj/comments/commentRss/378340.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/gaolei-xj/services/trackbacks/378340.html</trackback:ping><description><![CDATA[<div><br /><span style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; display: inline ! important; float: none;">浣跨敤SQLiteDatabase鐨刡eginTransaction()鏂規(guī)硶鍙互寮鍚竴涓簨鍔★紝紼嬪簭鎵ц鍒癳ndTransaction() 鏂規(guī)硶鏃朵細(xì)媯鏌ヤ簨鍔$殑鏍囧織鏄惁涓烘垚鍔燂紝濡傛灉涓烘垚鍔熷垯鎻愪氦浜嬪姟錛屽惁鍒欏洖婊氫簨鍔°傚綋搴旂敤闇瑕佹彁浜や簨鍔★紝蹇呴』鍦ㄧ▼搴忔墽琛屽埌endTransaction()鏂規(guī)硶涔嬪墠浣跨敤setTransactionSuccessful() 鏂規(guī)硶璁劇疆浜嬪姟鐨勬爣蹇椾負(fù)鎴愬姛錛屽鏋滀笉璋冪敤setTransactionSuccessful() 鏂規(guī)硶錛岄粯璁や細(xì)鍥炴粴浜嬪姟銆?br /><br /><div><span style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">浣跨敤渚嬪瓙濡備笅錛?/span></div></span><br /><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080; "> 1</span> <span style="color: #000000; "> SQLiteDatabase db </span><span style="color: #000000; ">=</span><span style="color: #000000; "> <img src="http://m.tkk7.com/Images/dot.gif" alt="" />.;<br /></span><span style="color: #008080; "> 2</span> <span style="color: #000000; ">db.beginTransaction();</span><span style="color: #008000; ">//</span><span style="color: #008000; ">寮濮嬩簨鍔?/span><span style="color: #008000; "><br /></span><span style="color: #008080; "> 3</span> <span style="color: #008000; "></span><span style="color: #0000FF; ">try</span><span style="color: #000000; "> {<br /></span><span style="color: #008080; "> 4</span> <span style="color: #000000; ">    db.execSQL(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">insert into person(name, age) values(?,?)</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> Object[]{</span><span style="color: #000000; ">"</span><span style="color: #000000; ">gaolei</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">22</span><span style="color: #000000; ">});<br /></span><span style="color: #008080; "> 5</span> <span style="color: #000000; ">    db.execSQL(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">update person set name=? where personid=?</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> Object[]{</span><span style="color: #000000; ">"</span><span style="color: #000000; ">zhangsan</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">1</span><span style="color: #000000; ">});<br /></span><span style="color: #008080; "> 6</span> <span style="color: #000000; ">    db.setTransactionSuccessful();</span><span style="color: #008000; ">//</span><span style="color: #008000; ">璋冪敤姝ゆ柟娉曚細(xì)鍦ㄦ墽琛屽埌endTransaction() 鏃舵彁浜ゅ綋鍓嶄簨鍔★紝濡傛灉涓嶈皟鐢ㄦ鏂規(guī)硶浼?xì)鍥炴粴浜嬪?/span><span style="color: #008000; "><br /></span><span style="color: #008080; "> 7</span> <span style="color: #008000; "></span><span style="color: #000000; ">} </span><span style="color: #0000FF; ">finally</span><span style="color: #000000; "> {<br /></span><span style="color: #008080; "> 8</span> <span style="color: #000000; ">    db.endTransaction();</span><span style="color: #008000; ">//</span><span style="color: #008000; ">鐢變簨鍔$殑鏍囧織鍐沖畾鏄彁浜や簨鍔★紝榪樻槸鍥炴粴浜嬪姟</span><span style="color: #008000; "><br /></span><span style="color: #008080; "> 9</span> <span style="color: #008000; "></span><span style="color: #000000; ">} <br /></span><span style="color: #008080; ">10</span> <span style="color: #000000;">db.close(); <br /></span></div></div><div><span style="color: #000000; font-family: 寰蔣闆呴粦; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">涓婇潰涓ゆ潯SQL璇彞鍦ㄥ悓涓涓簨鍔′腑鎵ц銆?/span></div><img src ="http://m.tkk7.com/gaolei-xj/aggbug/378340.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/gaolei-xj/" target="_blank">anthony</a> 2012-05-16 21:00 <a href="http://m.tkk7.com/gaolei-xj/archive/2012/05/16/378340.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>閲囩敤Pull瑙f瀽鍣ㄨВ鏋愬拰鐢熸垚XML鍐呭http://m.tkk7.com/gaolei-xj/archive/2012/05/13/378044.htmlanthonyanthonySun, 13 May 2012 07:38:00 GMThttp://m.tkk7.com/gaolei-xj/archive/2012/05/13/378044.htmlhttp://m.tkk7.com/gaolei-xj/comments/378044.htmlhttp://m.tkk7.com/gaolei-xj/archive/2012/05/13/378044.html#Feedback0http://m.tkk7.com/gaolei-xj/comments/commentRss/378044.htmlhttp://m.tkk7.com/gaolei-xj/services/trackbacks/378044.html     闄や簡鍙互浣跨敤 SAX鍜孌OM瑙f瀽XML鏂囦歡錛屽ぇ瀹朵篃鍙互浣跨敤Android鍐呯疆鐨凱ull瑙f瀽鍣ㄨВ鏋怷ML鏂囦歡銆?Pull瑙f瀽鍣ㄧ殑榪愯鏂瑰紡涓?SAX 瑙f瀽鍣?..  闃呰鍏ㄦ枃

anthony 2012-05-13 15:38 鍙戣〃璇勮
]]>
鎶婃枃浠跺瓨鏀懼湪SDCardhttp://m.tkk7.com/gaolei-xj/archive/2012/05/09/377737.htmlanthonyanthonyWed, 09 May 2012 12:35:00 GMThttp://m.tkk7.com/gaolei-xj/archive/2012/05/09/377737.htmlhttp://m.tkk7.com/gaolei-xj/comments/377737.htmlhttp://m.tkk7.com/gaolei-xj/archive/2012/05/09/377737.html#Feedback0http://m.tkk7.com/gaolei-xj/comments/commentRss/377737.htmlhttp://m.tkk7.com/gaolei-xj/services/trackbacks/377737.html
       浣跨敤Activity鐨刼penFileOutput()鏂規(guī)硶淇濆瓨鏂囦歡錛屾枃浠舵槸瀛樻斁鍦ㄦ墜鏈虹┖闂翠笂錛屼竴鑸墜鏈虹殑瀛樺偍絀洪棿涓嶆槸寰堝ぇ錛屽瓨鏀句簺灝忔枃浠惰繕琛岋紝濡傛灉瑕佸瓨鏀懼儚瑙嗛榪欐牱鐨勫ぇ鏂囦歡錛屾槸涓嶅彲琛岀殑銆傚浜庡儚瑙嗛榪欐牱鐨勫ぇ鏂囦歡錛屾垜浠彲浠ユ妸瀹冨瓨鏀懼湪SDCard銆?SDCard鏄共浠涔堢殑錛熶綘鍙互鎶婂畠鐪嬩綔鏄Щ鍔ㄧ‖鐩樻垨U鐩樸?/div>
       鍦ㄦā鎷熷櫒涓嬌鐢⊿DCard錛屼綘闇瑕佸厛鍒涘緩涓寮燬DCard鍗★紙褰撶劧涓嶆槸鐪熺殑SDCard錛屽彧鏄暅鍍忔枃浠訛級銆傚垱寤篠DCard鍙互鍦‥clipse鍒涘緩妯℃嫙鍣ㄦ椂闅忓悓鍒涘緩錛屼篃鍙互浣跨敤DOS鍛戒護(hù)榪涜鍒涘緩錛屽涓嬶細(xì)
鍦―os紿楀彛涓繘鍏ndroid SDK瀹夎璺緞鐨則ools鐩綍錛岃緭鍏ヤ互涓嬪懡浠ゅ垱寤轟竴寮犲閲忎負(fù)2G鐨凷DCard錛屾枃浠跺悗緙鍙互闅忎究鍙栵紝寤鴻浣跨敤.img錛?/div>
mksdcard 2048M D:\AndroidTool\sdcard.img
     

       瑕佸線SDCard瀛樻斁鏂囦歡錛岀▼搴忓繀欏誨厛鍒ゆ柇鎵嬫満鏄惁瑁呮湁SDCard錛屽茍涓斿彲浠ヨ繘琛岃鍐欍?br />娉ㄦ剰錛氳闂甋DCard蹇呴』鍦ˋndroidManifest.xml涓姞鍏ヨ闂甋DCard鐨勬潈闄?br />if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
         File sdCardDir = Environment.getExternalStorageDirectory();//鑾峰彇SDCard鐩綍
         File saveFile = new File(sdCardDir, “gaolei.txt”);
         FileOutputStream outStream = new FileOutputStream(saveFile);
         outStream.write("abc".getBytes());
         outStream.close();
}


      Environment.getExternalStorageState()鏂規(guī)硶鐢ㄤ簬鑾峰彇SDCard鐨勭姸鎬侊紝濡傛灉鎵嬫満瑁呮湁SDCard錛屽茍涓斿彲浠ヨ繘琛岃鍐欙紝

閭d箞鏂規(guī)硶榪斿洖鐨勭姸鎬佺瓑浜嶦nvironment.MEDIA_MOUNTED銆?br />          

      Environment.getExternalStorageDirectory()鏂規(guī)硶鐢ㄤ簬鑾峰彇SDCard鐨勭洰褰曪紝褰撶劧瑕佽幏鍙朣DCard鐨勭洰褰曪紝浣犱篃鍙互榪欐牱鍐欙細(xì)
File sdCardDir = new File("/mnt/sdcard"); //鑾峰彇SDCard鐩綍
File saveFile = new File(sdCardDir, "gaolei.txt"); 
//涓婇潰涓ゅ彞浠g爜鍙互鍚堟垚涓鍙ワ細(xì) File saveFile = new File("/mnt/sdcard/gaolei.txt");
FileOutputStream outStream = new FileOutputStream(saveFile);
outStream.write("abc".getBytes());
outStream.close();






anthony 2012-05-09 20:35 鍙戣〃璇勮
]]>鏌ョ湅搴旂敤杈撳嚭鐨勯敊璇俊鎭笌濡備綍閮ㄧ講搴旂敤鍒扮湡瀹炴墜鏈?/title><link>http://m.tkk7.com/gaolei-xj/archive/2012/05/06/377463.html</link><dc:creator>anthony</dc:creator><author>anthony</author><pubDate>Sun, 06 May 2012 01:40:00 GMT</pubDate><guid>http://m.tkk7.com/gaolei-xj/archive/2012/05/06/377463.html</guid><wfw:comment>http://m.tkk7.com/gaolei-xj/comments/377463.html</wfw:comment><comments>http://m.tkk7.com/gaolei-xj/archive/2012/05/06/377463.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/gaolei-xj/comments/commentRss/377463.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/gaolei-xj/services/trackbacks/377463.html</trackback:ping><description><![CDATA[<span style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">涓銆佹煡鐪嬪簲鐢ㄨ緭鍑虹殑閿欒淇℃伅<br />Window->Show View ->Other->Android ->LogCat<br /><img border="0" alt="" src="http://m.tkk7.com/images/blogjava_net/gaolei-xj/11.jpg" /><br /><p style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"> </p><div style="padding: 4px 5px 4px 4px; border: 1px solid rgb(204, 204, 204); width: 98%; font-size: 13px; word-break: break-all; background-color: rgb(238, 238, 238);"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: rgb(0, 0, 0);">鍦ˋndroid紼嬪簭涓彲浠ヤ嬌鐢?nbsp;android.util.Log 綾繪潵杈撳嚭鏃ュ織淇℃伅錛岃綾繪彁渚涗簡涓嬪垪鍑犱釜闈欐佹柟娉?br /><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />Log.v(String tag, String msg); <br /><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />Log.d(String tag, String msg); <br /><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />Log.i(String tag, String msg); <br /><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />Log.w(String tag, String msg); <br /><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />Log.e(String tag, String msg);<br /><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><br /><img align="top" src="http://m.tkk7.com/images/OutliningIndicators/None.gif" alt="" />鍒嗗埆瀵瑰簲 verbose, debug, info, warn, error</span></div><p style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"> </p><img border="0" alt="" src="http://m.tkk7.com/images/blogjava_net/gaolei-xj/12png.png" width="75" height="132" /><br /><a style="font: 18px/normal 寰蔣闆呴粦; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; cursor: pointer; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" title="鍙﹀" target="_blank">鍙﹀</a><span style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">榪樺彲浠ラ氳繃SDK鎻愪緵鐨?/span><a style="font: 18px/normal 寰蔣闆呴粦; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; cursor: pointer; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" title="宸ュ叿" target="_blank">宸ュ叿</a><span style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">鏉ョ湅錛屽懡浠ゆ槸 adb logcat 錛岃鍛戒護(hù)</span><a style="font: 18px/normal 寰蔣闆呴粦; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; cursor: pointer; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" title="鎵ц" target="_blank">鎵ц</a><span style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">鍚庝細(xì)浠ail鏂瑰紡瀹炴椂鏄劇ず鍑烘墍鏈夌殑鏃ュ織淇℃伅銆?br /><br /><div style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">浜屻佸浣曢儴緗插簲鐢ㄥ埌鐪熷疄鎵嬫満</div><div style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">1錛夊畨瑁呮墜鏈虹殑椹卞姩鍒皃c涓?/div><div style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">2錛夌敤涓鏉SB榪炴帴綰挎妸鎵嬫満榪炴帴鍒癙C鐨刄SB鎺ュ彛涓?/div><div style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Window->Show View ->Other->Android ->Devices<img border="0" alt="" src="http://m.tkk7.com/images/blogjava_net/gaolei-xj/12.jpg" /><br /><br /><div style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div>鑻ユ墜鏈洪┍鍔ㄥ畨瑁呮垚鍔燂紝鍒欏湪榪欓噷鏈夋樉紺轟綘鐨勬墜鏈鴻澶?/div></div><div style="font: 18px/normal 寰蔣闆呴粦; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; font-size-adjust: none; font-stretch: normal; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><p>3> 榪愯涓篴ndroid application錛屽嚭鐜癮ndroid device chooser鐣岄潰錛岄夋嫨鐪熷疄鎵嬫満錛堝鏋滄病鏈夊惎鍔ㄦā鎷熷櫒鐨勮瘽錛屼笉浼?xì)鍑虹帋图夈傛煡鐪嬪畨瑁呬俊鎭紝鍦╠evices涓弻鍑昏澶囥?/p><p>4> 杞歡鍙戝竷錛屼緵鐢ㄦ埛瀹夎銆傛妸杞歡鎵撳寘涓篴pk鏂囦歡銆侲xport—>android application—>鍒涘緩瀵嗛挜—>瀹夎鏂囦歡鏀劇疆浣嶇疆—>瀹屾垚銆?/p><p>5> 鏀懼叆sd鍗★紝鍦ㄧ湡鏈轟腑鐢╝pk姝e父瀹夎錛屽畨瑁呮椂浼?xì)鎻惤C猴紙鐢?shù)璇濆懠鍙櫒锛夈?/p><p><p>榪炰笂鎵嬫満涔嬪墠錛屾墦寮devices瑙嗗浘錛屽啀榪炴帴鎵嬫満錛屾墜鏈轟細(xì)鍑虹幇鍦ㄨ鍥句腑銆傚鏋滄墜鏈烘病鍑虹幇錛屽彲鑳介┍鍔ㄦ病瀹夎鎴愬姛銆?/p><p> </p><p>榪炴帴鎵嬫満鍙互閫氳繃灞忓箷鐩戣宸ュ叿asm.jar榪涜鎿嶄綔銆?/p><p> </p></div><br class="Apple-interchange-newline" /><br /><br /></div></span></span><img src ="http://m.tkk7.com/gaolei-xj/aggbug/377463.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/gaolei-xj/" target="_blank">anthony</a> 2012-05-06 09:40 <a href="http://m.tkk7.com/gaolei-xj/archive/2012/05/06/377463.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://m.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://sdzhly.com" target="_blank">国产精品酒店视频免费看</a>| <a href="http://czshenyue.com" target="_blank">免费黄网站在线看</a>| <a href="http://myzhoubian.com" target="_blank">亚洲免费综合色在线视频</a>| <a href="http://ytshdiping.com" target="_blank">久久亚洲最大成人网4438</a>| <a href="http://udlmw.com" target="_blank">亚洲一区二区三区久久</a>| <a href="http://5916733.com" target="_blank">亚洲乱码一二三四区国产</a>| <a href="http://yeshenghuowang.com" target="_blank">亚洲免费在线视频观看</a>| <a href="http://dbyssw.com" target="_blank">亚洲人成电影院在线观看</a>| <a href="http://tj-zhongfa.com" target="_blank">亚洲精品亚洲人成在线麻豆</a>| <a href="http://www664660a.com" target="_blank">亚洲成人黄色在线</a>| <a href="http://bdyls.com" target="_blank">亚洲综合丁香婷婷六月香</a>| <a href="http://ettedia.com" target="_blank">一区二区亚洲精品精华液</a>| <a href="http://igdytt.com" target="_blank">亚洲乱色伦图片区小说</a>| <a href="http://hkschooltv.com" target="_blank">亚洲爆乳大丰满无码专区 </a>| <a href="http://wbkk88.com" target="_blank">无码人妻久久一区二区三区免费丨 </a>| <a href="http://www3ratcom.com" target="_blank">亚洲黄色片在线观看</a>| <a href="http://1ygogo.com" target="_blank">亚洲国产美女视频</a>| <a href="http://www65axax.com" target="_blank">日本亚洲精品色婷婷在线影院</a>| <a href="http://aa7852.com" target="_blank">亚洲AV无码资源在线观看</a>| <a href="http://selangcun.com" target="_blank">免费VA在线观看无码</a>| <a href="http://5g6z.com" target="_blank">丝袜捆绑调教视频免费区</a>| <a href="http://wyj4.com" target="_blank">无码av免费一区二区三区</a>| <a href="http://9ytx.com" target="_blank">亚洲成人免费网站</a>| <a href="http://kmrghj.com" target="_blank">在线观看免费污视频</a>| <a href="http://www55nana.com" target="_blank">亚洲成年看片在线观看</a>| <a href="http://ytshdiping.com" target="_blank">国产亚洲成av片在线观看</a>| <a href="http://cjfuli.com" target="_blank">亚洲综合在线成人一区</a>| <a href="http://22youjizz.com" target="_blank">亚洲熟妇无码一区二区三区</a>| <a href="http://djyvp32.com" target="_blank">羞羞视频免费观看</a>| <a href="http://kingleadsw.com" target="_blank">日韩av无码免费播放</a>| <a href="http://tc116.com" target="_blank">国产香蕉免费精品视频</a>| <a href="http://05942688.com" target="_blank">日本免费人成黄页网观看视频</a>| <a href="http://www-84243.com" target="_blank">亚洲乱码国产一区网址</a>| <a href="http://ssdtsz.com" target="_blank">亚洲性天天干天天摸</a>| <a href="http://vod8090.com" target="_blank">久久夜色精品国产噜噜亚洲a</a>| <a href="http://usagaa.com" target="_blank">免费无码午夜福利片69</a>| <a href="http://maomaots.com" target="_blank">国产精品免费AV片在线观看</a>| <a href="http://zhaofeiz.com" target="_blank">无码人妻一区二区三区免费手机</a>| <a href="http://bjowj.com" target="_blank">国产人成免费视频</a>| <a href="http://pjappuiehjdkhsjkssd2.com" target="_blank">亚洲日韩中文无码久久</a>| <a href="http://df8848.com" target="_blank">亚洲国产成a人v在线观看</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>