Пример #1
0
 protected override void onCreate (android.os.Bundle arg0)
 {
     base.onCreate (arg0);
     
     LinearLayout layout = new LinearLayout (this);
     layout.setOrientation (LinearLayout.VERTICAL);
     Button btn = new Button (this);
     btn.setOnClickListener (this);
     btn.setText ("threaD");
     layout.addView (btn);
     
     btn2 = new Button (this);
     btn2.setText ("debug");
     btn2.setOnClickListener (new com.koushikdutta.monojavabridge.android.OnClickListener { OnClick = v =>
     {
         Console.WriteLine ("Foobar");
     } });
     layout.addView (btn2);
     
     tv = new TextView(this);
     layout.addView(tv);
     setContentView (layout);
     
 }
        protected override void onCreate(global::android.os.Bundle savedInstanceState)
        {
            // this activity 
            // check for db table
            // 
            //  shall resume on boot
            //  shall recheck every n seconds
            //  shall remember the last result
            //  shall remember how many iterations
            //  shall remember how many boots

            base.onCreate(savedInstanceState);

            #region setContentView
            ScrollView sv = new ScrollView(this);
            LinearLayout ll = new LinearLayout(this);
            ll.setOrientation(LinearLayout.VERTICAL);
            sv.addView(ll);

            var that = (Context)this;

            this.CancelPendingAlarm(NotifyServiceFromTimer.Class);


            #region startservice
            startservice = new Button(this);
            startservice.setText("Start Timer");
            startservice.setOnClickListener(
                new startservice_onclick { that = this }
            );
            ll.addView(startservice);
            #endregion

            #region stopservice
            stopservice = new Button(this);
            stopservice.setText("Stop Timer");
            stopservice.setEnabled(false);
            stopservice.setOnClickListener(
                new stopservice_onclick { that = this }
            );
            ll.addView(stopservice);
            #endregion


            CheckBox cb = new CheckBox(this);

            cb.setText("Start the timer earlier!");
            cb.setOnCheckedChangeListener(new cb_onchanged { that = this });

            __SQLiteConnectionHack.Context = this;

            using (var c = new SQLiteConnection(AbstractNotifyService.ConnectionString))
            {
                c.Open();

                var MyDataTable = new MyDataTable(c);

                cb.setChecked(MyDataTable.StartEarlier == 1);

                c.Close();


            }

            ll.addView(cb);

            this.setContentView(sv);
            #endregion



            var intent = new Intent(this, NotifyServiceFromActivity.Class);
            this.startService(intent);

        }
        protected override void onCreate(global::android.os.Bundle savedInstanceState)
        {
            // http://www.dreamincode.net/forums/topic/130521-android-part-iii-dynamic-layouts/

            base.onCreate(savedInstanceState);

            ScrollView sv = new ScrollView(this);

            LinearLayout ll = new LinearLayout(this);

            MainView = ll;

            ll.setOrientation(LinearLayout.VERTICAL);

            sv.addView(ll);

            //// http://stackoverflow.com/questions/9784570/webview-inside-scrollview-disappears-after-zooming
            //// http://stackoverflow.com/questions/8123804/unable-to-add-web-view-dynamically
            //// http://developer.android.com/reference/android/webkit/WebView.html



            TextView title = new TextView(this);
            title.setText("JSC Shopping Cart 2");
            ll.addView(title);

            TextView namelabel1 = new TextView(this);
            namelabel1.setText("First Name:");
            ll.addView(namelabel1);


            EditText nameET = new EditText(this);
            nameET.setText("");
            ll.addView(nameET);


            TextView lastnamelabel1 = new TextView(this);
            lastnamelabel1.setText("Last Name:");
            ll.addView(lastnamelabel1);


            EditText lastnameET = new EditText(this);
            lastnameET.setText("");
            ll.addView(lastnameET);


            TextView pkglabel1 = new TextView(this);
            pkglabel1.setText("Select Package:");
            //ll.addView(pkglabel1);

            RadioButton personalRb = new RadioButton(this);
            personalRb.setText("Personal License ($200)");
            //personalRb.AttachTo(ll);

            RadioButton enterpriseRb = new RadioButton(this);
            enterpriseRb.setText("Enterprise License ($400)");
            //enterpriseRb.AttachTo(ll);

            RadioButton commercialRb = new RadioButton(this);
            commercialRb.setText("Commercial License ($600)");
            //commercialRb.AttachTo(ll);

            RadioGroup groupRb = new RadioGroup(this);
            groupRb.addView(personalRb);
            groupRb.addView(enterpriseRb);
            groupRb.addView(commercialRb);
            groupRb.AttachTo(ll);

            Button submitBtn = new Button(this);
            submitBtn.setText("Submit");
            submitBtn.setOnClickListener(new Listener(ll));
            ll.addView(submitBtn);

            this.setContentView(sv);

            this.ShowLongToast("http://jsc-solutions.net");


        }
Пример #4
-1
        protected override void onCreate(Bundle arg0)
        {
            base.onCreate(arg0);

            LinearLayout layout = new LinearLayout(this);
            layout.setOrientation(LinearLayout.VERTICAL);

            TextView tv = new TextView(this);
            tv.setText("Hello");
            tv.setTextSize(20);
            layout.addView(tv);

            tv = new TextView(this);
            tv.setText("World!");
            tv.setTextSize(15);
            tv.setTextColor(unchecked((int)0xFF00FFFF));
            layout.addView(tv);

            button = new Button(this);
            button.setText("wtf");
            layout.addView(button);
            button.setOnClickListener(new OnClickListener()
            {
                OnClick = (v) =>
                {
                    Console.WriteLine(toString());
                    button.setText(System.Environment.TickCount.ToString());
                }
            });
            /* 
             * Normally in Java, you'd handle the onClickListener with an inner class.
             * In C# there is no inner class construct.
            button.setOnClickListener(new OnClickListener()
            {
                @Override
                public void onClick()
                {
                }
            });
            */

            setContentView(layout);
        }