註冊 登錄
Android 台灣中文網 返回首頁

wind8894的個人空間 https://apk.tw/?160066 [收藏] [複製] [分享] [RSS]

留言板

facelist

您需要登錄後才可以留言 登錄 | 註冊


top10001 2012-3-31 23:26

http://apk.tw/thread-70883-1-1.html <---------刷機教學大賽

http://apk.tw/thread-72999-1-1.html <---------美化教學大賽

george310909 2012-3-22 10:41
wind8894: @@
@@?
george310909 2012-3-21 21:43
package test.gl;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class testgl extends Activity {
        private Button mButton1;
        private TextView mTextView1;

        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                mButton1 = (Button) findViewById(R.id.myButton1);
                mTextView1 = (TextView) findViewById(R.id.myTextView1);
                mButton1.setOnClickListener(new Button.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                                String uriAPI = "http://www.google.com.tw";
                                HttpPost httpRequest = new HttpPost(uriAPI);
                                List<NameValuePair> params = new ArrayList<NameValuePair>();
                                params.add(new BasicNameValuePair("str", "I am Post String"));
                                try {
                                        httpRequest.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
                                        HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);
                                        if (httpResponse.getStatusLine().getStatusCode() == 200) {
                                                //接收原始碼的變數
                                                String strResult = EntityUtils.toString(httpResponse.getEntity());
                                                mTextView1.setText(strResult);
                                        } else {
                                                mTextView1.setText("Error Response: "+ httpResponse.getStatusLine().toString());
                                        }
                                } catch (ClientProtocolException e) {
                                        mTextView1.setText(e.getMessage().toString());
                                        e.printStackTrace();
                                } catch (IOException e) {
                                        mTextView1.setText(e.getMessage().toString());
                                        e.printStackTrace();
                                } catch (Exception e) {
                                        mTextView1.setText(e.getMessage().toString());
                                        e.printStackTrace();
                                }

                        }
                });
        }

        public String eregi_replace(String strFrom, String strTo, String strTarget) {
                String strPattern = "()" + strFrom;
                Pattern p = Pattern.compile(strPattern);
                Matcher m = p.matcher(strTarget);
                if (m.find()) {
                        return strTarget.replaceAll(strFrom, strTo);
                } else {
                        return strTarget;
                }
        }
}
我不知道為什麼回覆你要被審核個老半天= =
所以直接貼留言板給你了