24小时热门版块排行榜    

查看: 797  |  回复: 4

meanburg

新虫 (初入文坛)

[求助] 谁能给个android手机的显示程序?谢谢!

用单片机和wifi模块相连!再利用android手机的wifi功能把单片机上的数据经过wifi传到手机上!并显示出来!谁能给个android手机显示这一块的程序!急用啊!先谢谢大家了!
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

qqhegg

荣誉版主 (文坛精英)

珊瑚小美-----小元家的九妹

优秀版主优秀版主

我不太明白你要怎么做,反应慢呵呵,我有一个androidwifi的demo,自己写的程序,你看一下,希望有帮助!
每天都是新的一天,每天上帝都会给你不同的惊喜
2楼2012-04-10 16:40:27
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

qqhegg

荣誉版主 (文坛精英)

珊瑚小美-----小元家的九妹

优秀版主优秀版主

【答案】应助回帖

感谢参与,应助指数 +1
这个是wifi 的demo现在实现的功能是取得wifi网络提供点的信息SSID,BSSID但是不太明白你想要什么样的,所以只能给你这个你看一下,有没有用
public class WifitestActivity extends Activity {
    /** Called when the activity is first created. */
        private Button button1=null;
        private Button button2=null;
        private Button button3=null;
        private Button button4=null;
        private TextView text=null;
        private WifiManager wifi=null;
        private List list;  
        private ScanResult mScanResult;
         private List wificonfig;
        private StringBuffer mStringBuffer = new StringBuffer();
        private WifiInfo wifiInfo;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //
        button1=(Button)findViewById(R.id.button1);
        button2=(Button)findViewById(R.id.button2);
        button3=(Button)findViewById(R.id.button3);
        button4=(Button)findViewById(R.id.button4);
        text=(TextView)findViewById(R.id.text);
        //
      
      
        wifi=(WifiManager)WifitestActivity.this.getSystemService(Context.WIFI_SERVICE);
        wifiInfo=wifi.getConnectionInfo();
        //
        button1.setOnClickListener(new openListener());
        button2.setOnClickListener(new obtainIpListener());
        button3.setOnClickListener(new obtainMessageListener());
        button4.setOnClickListener(new closeListener());
        
    }
    public class openListener implements OnClickListener {

            @Override
            public void onClick(View v) {
                    // TODO Auto-generated method stub
                    int wifiState=wifi.getWifiState();
                    wifi.setWifiEnabled(true);
                    Toast.makeText(WifitestActivity.this, "wifi open"+wifiState, Toast.LENGTH_LONG).show();

            }

    }
    public class obtainIpListener implements OnClickListener {

            @Override
            public void onClick(View v) {
                    // TODO Auto-generated method stub
                     getAllNetWorkList();  

                   
            }
    }
    public class obtainMessageListener implements OnClickListener {

            @Override
            public void onClick(View v) {
                    // TODO Auto-generated method stub
                    //进行socket通信,获取数据
         try
         {
                 Socket socket=new Socket("192.168.2.7",80);
                 //未完待续
                 
         }
         catch(Exception e)
         {
                 e.printStackTrace();
         }
            }

    }
    public class closeListener implements OnClickListener {

            @Override
            public void onClick(View v) {
                    // TODO Auto-generated method stub
                   
                    wifi.setWifiEnabled(false);
                    Toast.makeText(WifitestActivity.this, "wifi close"+wifi.getWifiState(), Toast.LENGTH_LONG).show();
            }

    }
   
    public void getAllNetWorkList() {  
        // 每次点击扫描之前清空上一次的扫描结果   
        if (mStringBuffer != null) {  
            mStringBuffer = new StringBuffer();  
        }  
  
        // 开始扫描网络   
        wifi.startScan();  
        list =wifi.getScanResults();  
        // wificonfig=wifi.getConfiguredNetworks();
        if (list != null) {  
            for (int i = 0; i < list.size(); i++) {  
                mScanResult = list.get(i);  
                // 得到网络的SSID:the network name   
                mStringBuffer = mStringBuffer
                                .append("wifi SSID is:".append(mScanResult.SSID).append("\n"
                                .append("BSSID is: "  .append(mScanResult.BSSID).append("\n"
                                .append("capabilities is: "  .append(mScanResult.capabilities).append("\n"
                                .append("frequency is: " .append(mScanResult.frequency).append("\n"
                                .append("level is: " .append(mScanResult.level).append("\n"
                                .append("IP is: ".append(wifiInfo.getIpAddress()).append("\n"  
                        .append("getNetworkId is: ".append(wifiInfo.getNetworkId()).append("\n";  
            }  
           text.setText("扫描到的所有Wifi网络:\n" + mStringBuffer.toString());  
        }  
    }  

}
每天都是新的一天,每天上帝都会给你不同的惊喜
3楼2012-04-10 16:44:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

qqhegg

荣誉版主 (文坛精英)

珊瑚小美-----小元家的九妹

优秀版主优秀版主

对于上一贴的补充,我写的socket是想作为客户端
网上找到一个帖子,你看一下,android手机作为服务器端的代码
http://www.apkbus.com/forum.php? ... re_pos=1&ext=CB
希望有用

» 本帖已获得的红花(最新10朵)

每天都是新的一天,每天上帝都会给你不同的惊喜
4楼2012-04-10 16:59:34
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

meanburg

新虫 (初入文坛)

送鲜花一朵
引用回帖:
4楼: Originally posted by qqhegg at 2012-04-10 16:59:34:
对于上一贴的补充,我写的socket是想作为客户端
网上找到一个帖子,你看一下,android手机作为服务器端的代码
http://www.apkbus.com/forum.php?mod=viewthread&tid=20566&reltid=5380&pre_pos=1&a ...

灰常感谢!
5楼2012-04-16 13:31:14
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 meanburg 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 0703化学调剂 +8 妮妮ninicgb 2026-03-15 12/600 2026-03-19 05:55 by anny19840123
[考研] 0703化学调剂,求各位老师收留 +10 秋有木北 2026-03-14 10/500 2026-03-19 05:52 by anny19840123
[考研] 294求调剂材料与化工专硕 +5 陌の森林 2026-03-18 5/250 2026-03-18 22:18 by bingxueer79
[考研] 材料专业求调剂 +5 hanamiko 2026-03-18 5/250 2026-03-18 20:19 by 星空星月
[考研] 085601材料工程专硕求调剂 +6 慕寒mio 2026-03-16 6/300 2026-03-18 14:26 by 007_lilei
[考研] 收复试调剂生 +4 雨后秋荷 2026-03-18 4/200 2026-03-18 14:16 by elevennnne
[考研] 302求调剂 +10 呼呼呼。。。。 2026-03-17 10/500 2026-03-18 12:45 by Linda Hu
[考研] 268求调剂 +6 简单点0 2026-03-17 6/300 2026-03-18 09:04 by 无际的草原
[考研] 293求调剂 +11 zjl的号 2026-03-16 16/800 2026-03-18 08:10 by zhukairuo
[考研] 308求调剂 +4 是Lupa啊 2026-03-16 4/200 2026-03-17 17:12 by ruiyingmiao
[考研] 274求调剂 +5 时间点 2026-03-13 5/250 2026-03-17 07:34 by 热情沙漠
[考研] 一志愿华中师范071000,325求调剂 +6 RuitingC 2026-03-12 6/300 2026-03-16 14:50 by 可淡不可忘
[考博] 东华理工大学化材专业26届硕士博士申请 +6 zlingli 2026-03-13 6/300 2026-03-15 20:00 by ryzcf
[考研] 265求调剂 +4 威化饼07 2026-03-12 4/200 2026-03-14 17:23 by userper
[考研] 255求调剂 +3 李嘉慧, 2026-03-12 4/200 2026-03-14 16:58 by 有只狸奴
[考研] 308 085701 四六级已过求调剂 +7 温乔乔乔乔 2026-03-12 14/700 2026-03-14 10:49 by JourneyLucky
[考研] 304求调剂 +7 7712b 2026-03-13 7/350 2026-03-13 21:42 by peike
[考研] 311求调剂 +3 冬十三 2026-03-13 3/150 2026-03-13 20:41 by JourneyLucky
[考研] 070303一志愿西北大学学硕310找调剂 +3 d如愿上岸 2026-03-13 3/150 2026-03-13 10:43 by houyaoxu
[考博] 福州大学杨黄浩课题组招收2026年专业学位博士研究生,2026.03.20截止 +3 Xiangyu_ou 2026-03-12 3/150 2026-03-13 09:36 by duanwu655
信息提示
请填处理意见