24小时热门版块排行榜    

查看: 910  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 2027广东省杰青 +3 奶牛小黑 2026-08-15 9/450 2026-08-18 20:09 by 奶牛小黑
[基金申请] 朋友圈看到的 +4 wangzilk 2026-08-18 5/250 2026-08-18 19:25 by wangzilk
[基金申请] 欢迎发来filecode的Mz6后的代码验证其规律 +51 医学老男孩 2026-08-13 110/5500 2026-08-18 19:07 by icerianxia
[基金申请] 明天放榜? +5 Shxjjxjkx 2026-08-18 5/250 2026-08-18 18:14 by -大大大大大-
[基金申请] 重要消息,中午系统在维护 +9 yuleib84 2026-08-18 10/500 2026-08-18 16:52 by archvillain
[论文投稿] 投稿咨询 +4 wwm09 2026-08-17 6/300 2026-08-18 15:36 by wwm09
[基金申请] 时间戳又变了8-15 +14 archvillain 2026-08-15 26/1300 2026-08-18 13:37 by phantomgost
[基金申请] 今天维护系统维护 祝所有人 高中 +8 gjjjzhong 2026-08-18 9/450 2026-08-18 13:01 by 家与远方
[基金申请] 哪位老哥知道今年的国自然具体哪一天放榜? +13 Ldrop2023 2026-08-13 16/800 2026-08-18 12:25 by 淀粉搬运工
[基金申请] 快农历七夕节了,轻松一下,男人悄悄话,女施主请不要进来。 +4 Tide man 2026-08-14 5/250 2026-08-18 11:35 by Tide man
[基金申请] 93BebMhtakh前后11位开头都是大写 +4 且听虎啸 2026-08-17 5/250 2026-08-18 00:49 by 蔡棒棒菂
[基金申请] filecode=后面第一个是大写字母 +8 wangze12014 2026-08-14 10/500 2026-08-17 17:05 by xter9665
[基金申请] 今天系统多次维护,明天很可能放榜! +8 zju2000 2026-08-16 9/450 2026-08-17 12:20 by lmz0216
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 26/1300 2026-08-16 12:35 by 启萌科技
[精细化工] 招聘 金属平磨液,抛光液研发工程师 +3 小天0311 2026-08-14 3/150 2026-08-16 07:31 by H9PLUS
[基金申请] 各位道友,我要去昆明玩几天,回来见。 +7 Tide man 2026-08-14 8/400 2026-08-15 01:11 by arzu_hma
[基金申请] 重要来源:本周末出结果 +10 瞬息宇宙 2026-08-12 10/500 2026-08-13 15:46 by likettle
[基金申请] 不应该看fileCode +7 且听虎啸 2026-08-12 9/450 2026-08-13 14:27 by flydreamws
[基金申请] Filecode 又变了,巨变 +3 WH3796 2026-08-12 4/200 2026-08-13 14:13 by 小木虫6752397
[基金申请] 结合人工智能,周易传统文化,filecode打分制来了,3分以上希望很大。 +3 Tide man 2026-08-12 4/200 2026-08-13 08:35 by ZJTJZ
信息提示
请填处理意见