久久久久久五月天久久久久久久久,国产+人+亚洲,国产精品免费视频一区http://www.aygfsteel.com/pengo/category/47871.htmlzh-cnWed, 02 Nov 2011 00:35:08 GMTWed, 02 Nov 2011 00:35:08 GMT60把android手機變成電腦的無線觸摸板http://www.aygfsteel.com/pengo/archive/2011/08/30/357612.htmlpenngopenngoTue, 30 Aug 2011 15:24:00 GMThttp://www.aygfsteel.com/pengo/archive/2011/08/30/357612.htmlhttp://www.aygfsteel.com/pengo/comments/357612.htmlhttp://www.aygfsteel.com/pengo/archive/2011/08/30/357612.html#Feedback5http://www.aygfsteel.com/pengo/comments/commentRss/357612.htmlhttp://www.aygfsteel.com/pengo/services/trackbacks/357612.html業余小作,用途把手機變成電腦的無線觸摸板,可以遠程操作電腦。寫這個是因為自己平時看電影,電影看完,不想動身去換下一部,遂寫了這個小工具方便遠程操作電腦
程序分PC端和手機端
PC端在window 7測試過
手機端只在android模擬器2.2,2.3測試過,真機只在HTC的G11(android2.3.3)測試過

運行程序前,請先把電腦和手機連上同一個WIFI網絡,如果沒有WIFI網絡,可以開啟手機的便攜式WLAN熱點功能,再用電腦連上手機的WIFI。

PC端程序界面

運行程序,可以設置連接密碼,程序處于開啟狀態,這樣手機才能連上電腦

手機端程序界面

輸入PC端的IP、端口、密碼,連接(請確保PC和手機連上同一個WIFI網絡),連接成功,將進入下一個界面


連接成功后進入的界面,操作方式和手提的觸摸板類似

安裝程序
android客戶端
motouch_android.apk

PC主機端
motouch_pc.zip(26M,完整的安裝程序包)
motouch.pc.no_jre.zip(1.4M,需要自行安裝jre6)



penngo 2011-08-30 23:24 發表評論
]]>
在android中使用jsoup解析頁面鏈接http://www.aygfsteel.com/pengo/archive/2011/03/14/346176.htmlpenngopenngoSun, 13 Mar 2011 17:35:00 GMThttp://www.aygfsteel.com/pengo/archive/2011/03/14/346176.htmlhttp://www.aygfsteel.com/pengo/comments/346176.htmlhttp://www.aygfsteel.com/pengo/archive/2011/03/14/346176.html#Feedback1http://www.aygfsteel.com/pengo/comments/commentRss/346176.htmlhttp://www.aygfsteel.com/pengo/services/trackbacks/346176.html本來想直接看sdk中的doc文檔來學習android的,結果發現里面的英文資料,學起來速度有點慢,遂買了本android的教程書回來學習,剛好看到一個書里面一個使用java.net.URL訪問網頁的例子,之前在做采集的時候,使用了html解析器jsoup來獲取頁面所有鏈接,順便試下把jsoup放進android中使用下,發現jsoup在android中能直接使用,測試例子代碼(本文只作了簡單測試):
tt.jsp頁面

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding
="UTF-8"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
測試連接
<href="http://www.aygfsteel.com/pengo/">penngo的博客</a>
<href="http://www.aygfsteel.com/">blogjava博客</a>
</body>
</html>


Activity01.java

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class Activity01 extends Activity
{
    @Override
    
public void onCreate(Bundle savedInstanceState)
    
{
        
super.onCreate(savedInstanceState);
        
        setContentView(R.layout.main);

        TextView tv 
= new TextView(this);
        
        String myString 
= null;
        StringBuffer sff 
= new StringBuffer();
        
try
        
{
            Document doc 
= Jsoup.connect("http://192.168.64.9:8099/AgentJava/tt.jsp").get();
            Elements links 
= doc.select("a[href]");
            
for(Element link : links){
                sff.append(link.attr(
"abs:href")).append("  ").append(link.text()).append("\n");
            }

            myString 
= sff.toString();
        }

        
catch (Exception e)
        
{

            myString 
= e.getMessage();
            e.printStackTrace();
        }

        
/* 將信息設置到TextView */
        tv.setText(myString);
        
        
/* 將TextView顯示到屏幕上 */
        
this.setContentView(tv);
    }

}

運行效果:

本文是在android2.2中開發測試,jsoup在android上使用和在jdk上使用是一樣,不用改變代碼。

源碼

penngo 2011-03-14 01:35 發表評論
]]>
開始android的HelloWorldhttp://www.aygfsteel.com/pengo/archive/2011/02/23/344883.htmlpenngopenngoTue, 22 Feb 2011 16:44:00 GMThttp://www.aygfsteel.com/pengo/archive/2011/02/23/344883.htmlhttp://www.aygfsteel.com/pengo/comments/344883.htmlhttp://www.aygfsteel.com/pengo/archive/2011/02/23/344883.html#Feedback2http://www.aygfsteel.com/pengo/comments/commentRss/344883.htmlhttp://www.aygfsteel.com/pengo/services/trackbacks/344883.htmlhttp://androidappdocs-staging.appspot.com/sdk/index.html)把android-sdk_r09-windows.zip下了回來,本來以為下了這個就能開始寫helloWorld,點知里面根本沒有開發的SDK和相關的開發工具,通過這地址https://dl-ssl.google.com/android/eclipse/給eclipse安裝ADT插件。安裝完ADT,利用SDK Manager.exe開始漫長的SDK下載,足足下了兩個晚上才下完。按著它官方的Tutorials,等了兩個晚上終于可以開始HelloWorld。
HelloAndroid.java
import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends Activity {
    
/** Called when the activity is first created. */
    @Override
    
public void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState); 
        setContentView(R.layout.main); 
    }

}

main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation
="vertical" 
    android:layout_width
="fill_parent" 
    android:layout_height
="fill_parent"> 
 
  
<LinearLayout 
      
android:orientation="horizontal" 
      android:layout_width
="fill_parent" 
      android:layout_height
="fill_parent" 
      android:layout_weight
="1"> 
      
<TextView 
          
android:text="red" 
          android:gravity
="center_horizontal" 
          android:background
="#aa0000" 
          android:layout_width
="wrap_content" 
          android:layout_height
="fill_parent" 
          android:layout_weight
="1"/> 
      
<TextView 
          
android:text="green" 
          android:gravity
="center_horizontal" 
          android:background
="#00aa00" 
          android:layout_width
="wrap_content" 
          android:layout_height
="fill_parent" 
          android:layout_weight
="1"/> 
      
<TextView 
          
android:text="blue" 
          android:gravity
="center_horizontal" 
          android:background
="#0000aa" 
          android:layout_width
="wrap_content" 
          android:layout_height
="fill_parent" 
          android:layout_weight
="1"/> 
      
<TextView 
          
android:text="yellow" 
          android:gravity
="center_horizontal" 
          android:background
="#aaaa00" 
          android:layout_width
="wrap_content" 
          android:layout_height
="fill_parent" 
          android:layout_weight
="1"/> 
  
</LinearLayout> 
         
  
<LinearLayout 
    
android:orientation="vertical" 
    android:layout_width
="fill_parent" 
    android:layout_height
="fill_parent" 
    android:layout_weight
="1"> 
    
<TextView 
        
android:text="row one" 
        android:textSize
="15pt" 
        android:layout_width
="fill_parent" 
        android:layout_height
="wrap_content" 
        android:layout_weight
="1"/> 
    
<TextView 
        
android:text="row two" 
        android:textSize
="15pt" 
        android:layout_width
="fill_parent" 
        android:layout_height
="wrap_content" 
        android:layout_weight
="1"/> 
    
<TextView 
        
android:text="row three" 
        android:textSize
="15pt" 
        android:layout_width
="fill_parent" 
        android:layout_height
="wrap_content" 
        android:layout_weight
="1"/> 
    
<TextView 
        
android:text="row four" 
        android:textSize
="15pt" 
        android:layout_width
="fill_parent" 
        android:layout_height
="wrap_content" 
        android:layout_weight
="1"/> 
  
</LinearLayout> 
</LinearLayout>


下面是個人對這兩個文件的小小見解:

main.xml用來描述程序的用戶界面,感覺通過xml來描述頁面布局這方式很流行,Silverlight使用XAML描述頁面布局,QT使用QML描述界面,看來XML UI描述語言在桌面應用將會更廣泛,在PB、Delphi、VC、VB年代,根據還未聽過有XML UI,不過HTML在BS的應用倒是讓所有人如雷貫耳,哈哈。android的XML UI與QT相比,還弱了點,因為QML支持js,不知哈時候,android能支持js,不過寫這篇文章的前一天剛好看到Qt for Android (Alpha) 發布新聞,就是不知java版的SDK哈時候能做到這一步。
HelloAndroid繼承Activity,Activity具有自己的生命周期,也就是按一定的事件流程運行,從開始到銷毀的事件流程為
void onCreate(Bundle savedInstanceState)
void onStart()
void onRestart()
void onResume()
void onPause()
void onStop()
void onDestroy()
這讓我覺得它和applet非常相似,
applet生命周期
void init()
void start()
void stop()
void destroy()

目前android還不熟悉,暫寫這么多記錄下來,有空再繼續學習。



penngo 2011-02-23 00:44 發表評論
]]>
主站蜘蛛池模板: 安溪县| 内黄县| 淮南市| 张家川| 塔河县| 丰宁| 阿鲁科尔沁旗| 涪陵区| 宁远县| 武平县| 达拉特旗| 石屏县| 嘉禾县| 内乡县| 南丰县| 香港| 宁武县| 青铜峡市| 夹江县| 长垣县| 保德县| 宜宾市| 大庆市| 元阳县| 三河市| 万州区| 杂多县| 苍南县| 确山县| 华池县| 汉沽区| 新余市| 洛阳市| 营山县| 茂名市| 长沙市| 阜阳市| 芦溪县| 延吉市| 郎溪县| 文水县|