Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            //SetContentView(Resource.Layout.List);
            // Create your application here
            string prefix = Intent.GetStringExtra("servlist");

            string[] smlist = prefix.Split('/');
            serv = new List <SerMod>();
            for (int i = 0; i < smlist.Length - 1; i++)
            {
                SerMod ss = new SerMod(smlist[i]);
                serv.Add(ss);
            }

            ListAdapter = new ServAdapter(this, serv);



            ListView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs e)
            {
                Intent result = new Intent();
                result.SetClass(this, typeof(DetailActivity));
                result.PutExtra("serv", serv[e.Position].ToStringExt());
                StartActivity(result);
            };
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Detail);
            // Create your application here

            string prefix = Intent.GetStringExtra("serv");
            SerMod ss     = new SerMod(prefix);

            WebView wv = FindViewById <WebView>(Resource.Id.webView_detail);

            WebSettings settings = wv.Settings;

            //设置编码
            settings.DefaultTextEncodingName = "utf-8";
            settings.JavaScriptEnabled       = true;
            settings.LoadWithOverviewMode    = true;
            //settings.setSupportZoom = true;
            settings.DomStorageEnabled = true; //
            //settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
            settings.AllowFileAccess = true;   // 设置允许访问文件数据
            settings.UseWideViewPort = true;
            //settings.setSupportMultipleWindows(true);
            settings.BlockNetworkImage = false;  ///同步请求图片


            //设置背景颜色 透明
            //wv.Background = new Color.argb(0, 0, 0, 0);
            //设置本地调用对象及其接口
            wv.AddJavascriptInterface(this, "callByJs");

            wv.LoadUrl("file:///android_asset/Chat.html");
            //wv.LoadUrl("javascript:alert('hello js')");
        }
Example #3
0
        private void ReceiveMessage()
        {
            while (true)
            {
                try
                {
                    int receiveNumber = cSocket.Receive(result);   // 136byte for each, '\0' in the last
                    if (receiveNumber > 0)
                    {
                        servlist = new List <SerMod>();
                        int ctmp = receiveNumber / MdfySS;
                        for (int i = 0; i < ctmp; i++)
                        {
                            byte[] btmp = new byte[MdfySS];
                            Array.Copy(result, i * MdfySS, btmp, 0, MdfySS);
                            SerMod tmp = new SerMod(btmp);
                            servlist.Add(tmp);
                        }

                        Message msg = new Message();
                        if (servlist.Count > 0)
                        {
                            msg.What = 0x1;
                        }
                        else
                        {
                            msg.What = 0x0;
                        }
                        cHandler.SendMessage(msg);
                    }
                }
                catch
                {
                    cSocket.Shutdown(SocketShutdown.Both);
                    cSocket.Close();
                    break;
                }
            }
        }