// connect s6 via usb . // turn on wifi! // kill adb //"x:\util\android-sdk-windows\platform-tools\adb.exe" tcpip 5555 // restarting in TCP mode port: 5555 //13: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 // inet 192.168.1.126/24 brd 192.168.1.255 scope global wlan0 // valid_lft forever preferred_lft forever // on red // "x:\util\android-sdk-windows\platform-tools\adb.exe" connect 192.168.1.126:5555 // connected to 192.168.1.126:5555 // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201511/20151121 // http://stackoverflow.com/questions/17513502/support-for-multi-window-app-development protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://www.dreamincode.net/forums/topic/130521-android-part-iii-dynamic-layouts/ base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this); b.setText("Vibrate!"); b.AtClick( delegate { var vibrator = (Vibrator)this.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(600); } ); ll.addView(b); this.setContentView(sv); //this.ShowLongToast("http://my.jsc-solutions.net x"); }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); b.WithText("popup"); b.AtClick( v => { XStandOutWindow.closeAll(this, typeof(XWidgetsWindow).ToClass()); XStandOutWindow.show(this, typeof(XWidgetsWindow).ToClass(), XStandOutWindow.DEFAULT_ID); this.finish(); } ); this.setContentView(sv); }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this); b.setText("I don't do anything, but I was added dynamically. :)"); ll.addView(b); Action onclick = delegate { b.setText("onclick"); }; b.setText("before AtClick"); b.AtClick( v => { b.setText("AtClick"); } ); var b2 = new Button(this); b2.setText("The other button!"); ll.addView(b2); this.setContentView(sv); }
// X:\opensource\ovr_mobile_sdk_0.5.0 // https://developer.oculus.com/downloads/#version=mobile-0.5.0 //<ItemGroup> // <Content Include="X:\opensource\ovr_mobile_sdk_20141111\VRLib\src\**\*.*"> // <Link>opensource\ovr_mobile_sdk_20141111\VRLib\src\%(RecursiveDir)%(FileName)%(Extension)</Link> // </Content> //</ItemGroup> // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150402 // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20141127 // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150504/dae // http://stackoverflow.com/questions/9821875/where-is-buildconfig-debug // tested by? protected override void onCreate(global::android.os.Bundle savedInstanceState) { // cmd /K c:\util\android-sdk-windows\platform-tools\adb.exe logcat // Camera PTP // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); ScrollView sv = new ScrollView(this); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); Button b = new Button(this); b.setText("Notify!"); int counter = 0; ll.addView(b); this.setContentView(sv); this.ShowToast("http://jsc-solutions.net"); }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); b.WithText(Foo.Bar("hello via .java")); b.AtClick( v => { b.WithText(Foo.Bar("click!")); } ); this.setContentView(sv); }
protected override void onCreate(Bundle savedInstanceState) { var activity = this; base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); b.WithText("before AtClick"); b.AtClick( v => { b.setText("AtClick"); } ); }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); b.WithText("before AtClick"); b.AtClick( v => { b.setText("AtClick"); } ); var b2 = new Button(this); b2.setText("The other button!"); ll.addView(b2); this.setContentView(sv); }
// http://stackoverflow.com/questions/6274141/trigger-background-service-at-a-specific-time-in-android // http://stackoverflow.com/questions/7144908/how-is-an-intent-service-declared-in-the-android-manifest // http://developer.android.com/guide/topics/manifest/service-element.html protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); ScrollView sv = new ScrollView(this); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); #region startservice var startservice = new Button(this); startservice.setText("Start Service to send Notification"); startservice.AtClick( delegate { this.ShowToast("startservice_onclick"); var intent = new Intent(this, typeof(NotifyService).ToClass()); this.startService(intent); } ); ll.addView(startservice); #endregion #region stopservice var stopservice = new Button(this); stopservice.setText("Stop Service"); stopservice.AtClick( delegate { this.ShowToast("stopservice_onclick"); Intent intent = new Intent(); intent.setAction(NotifyService.ACTION); intent.putExtra("RQS", NotifyService.RQS_STOP_SERVICE); this.sendBroadcast(intent); } ); ll.addView(stopservice); #endregion this.setContentView(sv); this.ShowToast("http://jsc-solutions.net"); }
protected override void onCreate(global::android.os.Bundle savedInstanceState) { // why isnt jsc doing automatic ref? var r = default(global::ScriptCoreLib.Android.Windows.Forms.IAssemblyReferenceToken_Forms); ScriptCoreLib.Android.ThreadLocalContextReference.CurrentContext = this; // X:\jsc.svn\examples\java\android\forms\FormsMessageBox\FormsMessageBox\Library\ApplicationControl.cs // cmd /K c:\util\android-sdk-windows\platform-tools\adb.exe logcat // Camera PTP // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new android.widget.Button(this); // jsc is doing the wrong thing here //var SDK_INT = android.os.Build.VERSION.SDK_INT; //b.setText("Notify! " + new { SDK_INT, android.os.Build.VERSION.SDK }); b.setText("Notify! "); int counter = 0; b.AtClick( delegate { counter++; var f = new Form1(); var value = f.ShowDialog(); b.setText("ShowDialog! " + new { value, f.textBox1.Text }); } ); ll.addView(b); this.setContentView(sv); }
protected override void onCreate(global::android.os.Bundle savedInstanceState) { // why isnt jsc doing automatic ref? var r = default(global::ScriptCoreLib.Android.Windows.Forms.IAssemblyReferenceToken_Forms); ScriptCoreLib.Android.ThreadLocalContextReference.CurrentContext = this; // X:\jsc.svn\examples\java\android\forms\FormsMessageBox\FormsMessageBox\Library\ApplicationControl.cs // cmd /K c:\util\android-sdk-windows\platform-tools\adb.exe logcat // Camera PTP // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new android.widget.Button(this); // jsc is doing the wrong thing here //var SDK_INT = android.os.Build.VERSION.SDK_INT; //b.setText("Notify! " + new { SDK_INT, android.os.Build.VERSION.SDK }); b.setText("Notify! " ); int counter = 0; b.AtClick( delegate { counter++; var f = new Form1(); var value = f.ShowDialog(); b.setText("ShowDialog! " + new { value, f.textBox1.Text }); } ); ll.addView(b); this.setContentView(sv); }
static __InitializeAndroidActivity() { Console.WriteLine("StaticInvoke"); // Exception Ljava/lang/RuntimeException; thrown while initializing LTryHideActionbarExperiment/StaticInvoke; try { // https://groups.google.com/forum/?fromgroups=#!topic/android-developers/suLMCWiG0D8 var c = ScriptCoreLib.Android.ThreadLocalContextReference.CurrentContext; (ScriptCoreLib.Android.ThreadLocalContextReference.CurrentContext as Activity).runOnUiThread( a => { // http://stackoverflow.com/questions/4451641/change-android-layout-programatically var sv = new ScrollView(a); var ll = new LinearLayout(a); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(a).AttachTo(ll); b.WithText("before AtClick"); b.AtClick( v => { b.setText("AtClick"); } ); var b2 = new Button(a); b2.setText("The other button!"); ll.addView(b2); a.setContentView(sv); } ); } catch (Exception ex) { Console.WriteLine("error: " + new { ex.Message, ex.StackTrace }); } }
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); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this); b.setText("Vibrate!"); b.AtClick( delegate { var vibrator = (Vibrator)this.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(600); } ); ll.addView(b); this.setContentView(sv); //this.ShowLongToast("Monese circle progressbar"); //circularSeekbar = new CircularSeekBar(this); //circularSeekbar.setMaxProgress(100); //circularSeekbar.setProgress(100); //setContentView(circularSeekbar); //circularSeekbar.invalidate(); //circularSeekbar.setSeekBarChangeListener(new TestAndroidCircleProgressbar.Activities.CircularSeekBar.MyOnSeekChangeListener()); }
// http://stackoverflow.com/questions/6274141/trigger-background-service-at-a-specific-time-in-android // http://stackoverflow.com/questions/7144908/how-is-an-intent-service-declared-in-the-android-manifest // http://developer.android.com/guide/topics/manifest/service-element.html //AtBootCompleted hack1; protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); ScrollView sv = new ScrollView(this); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var btn = new Button(this); btn.setText("wifi"); ll.addView(btn); { ConnectivityManager connManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifiNetInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); NetworkInfo mobileNetInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); if (wifiNetInfo != null) if (wifiNetInfo.isConnectedOrConnecting()) { btn.setText("we are connected via WiFi"); } if (mobileNetInfo != null) if (mobileNetInfo.isAvailable()) if (mobileNetInfo.isConnected()) { btn.setText(" we are connected via mobile data (GPRS, 3G, etc.)"); } } this.setContentView(sv); this.StartPendingAlarm(typeof(NotifyService), 1000 * 1, 0); }
// http://stackoverflow.com/questions/19954156/android-build-separate-apks-for-different-processor-architectures // "X:\jsc.svn\examples\java\android\Test\TestChromeAsAsset\TestChromeAsAsset.sln" // [aapt] W:\bin\AndroidManifest.xml:14: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name'). protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://www.dreamincode.net/forums/topic/130521-android-part-iii-dynamic-layouts/ base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this); b.setText( // X:\jsc.svn\examples\c\android\Test\TestNDKAsAsset\TestNDKAsAsset\Program.cs // http://stackoverflow.com/questions/19954156/android-build-separate-apks-for-different-processor-architectures // <package id="TestNDKAsAssetFromSharedLibrary" version="1.0.0.0" targetFramework="net4" userInstalled="true" /> // X:\jsc.svn\examples\java\android\synergy\OVRVrCubeWorldNativeActivity\OVRVrCubeWorldNativeActivity\ApplicationActivity.cs // can we load that native so into a separate process? // switch to native and back? TestNDKAsAsset.xActivity.stringFromJNI() //"Vibrate!" ); b.AtClick( delegate { var vibrator = (Vibrator)this.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(600); } ); ll.addView(b); this.setContentView(sv); //this.ShowLongToast("http://my.jsc-solutions.net x"); }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); b.AtClick( v => { b.setText("AtClick"); } ); //var b2 = new Button(this); //b2.setText("The other button!"); //ll.addView(b2); var ipa = Dns.GetHostAddresses(getLocalIpAddress())[0]; var port = 8080; b.WithText(ipa + ":" + port); ClassLibrary1.Class1Shared.CreateServer( ipa, port, x => { //b.WithText(x); android.util.Log.wtf("APKWebServer", x); } ).Start(); this.setContentView(sv); }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); var uri = new Uri("http://download.jsc-solutions.net/foo/bar.txt?a=1&b=2#frag1/frag2"); Action<string> w = (x) => new Button(this).WithText(x).AttachTo(ll); w( new { uri.OriginalString, uri.Port, uri.Query, uri.PathAndQuery, uri.Fragment, uri.Host }.ToString() ); this.setContentView(sv); //var foo = new Foo<FooElement>(); //foo.Invoke(w); }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); var goo = new foo.Goo(); //Activator.CreateInstance< //var goo = (foo.Goo)Activator.CreateInstance( // typeof(foo.Goo) //); //E/AndroidRuntime(32112): Caused by: java.lang.RuntimeException //E/AndroidRuntime(32112): at foo.Bar.GetBarString(Bar.java:29) //E/AndroidRuntime(32112): at foo.Goo.GetString(Goo.java:9) //E/AndroidRuntime(32112): at TestJavaNativesOverride.Activities.ApplicationActivity.onCreate(ApplicationActivity.java:69) b.WithText(goo.GetString()); b.AtClick( v => { b.setText( new assets::foo.Bar().GetBarString() ); } ); this.setContentView(sv); }
// 3 years later! // port from http://www.learnopengles.com/android-lesson-six-an-introduction-to-texture-filtering/ // Y:\opensource\github\Learn-OpenGLES-Tutorials\android\AndroidOpenGLESLessons\src\com\learnopengles\android\lesson6 protected override void onCreate(global::android.os.Bundle savedInstanceState) { base.onCreate(savedInstanceState); //this.ToFullscreen(); var fl = new FrameLayout(this); var ll = new LinearLayout(this); ll.setHorizontalGravity(Gravity.CENTER_HORIZONTAL); ll.setVerticalGravity(Gravity.BOTTOM); var button_set_min_filter = new Button(this).AttachTo(ll).WithText("Set min. filter"); var button_set_mag_filter = new Button(this).AttachTo(ll).WithText("Set mag. filter"); var v = new RenderingContextView(this).AttachTo(fl); var s = new ApplicationSurface(v, button_set_min_filter, button_set_mag_filter, this); ll.AttachTo(fl); #region density var displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); v.mDensity = displayMetrics.density; #endregion setContentView(fl); this.ShowToast("http://my.jsc-solutions.net"); }
// BUILD FAILED //x:\util\android-sdk-windows\tools\ant\build.xml:542: Unable to resolve project target 'Google Inc.:Google APIs:21' // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201505/20150503/udp // http://www.happygeek.in/programmatically-get-device-imei-in-android protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); Button b = new Button(this).WithText("Whats my IMEI?").AtClick( delegate { TelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE); string imei = telephonyManager.getDeviceId(); this.setTitle(new { imei }.ToString()); //this.ShowLongToast("IMEI: " + imei); } ); ll.addView(b); this.setContentView(sv); }
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(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); { var b = new Button(this).AttachTo(ll); b.WithText("extras:"); } // http://about-android.blogspot.com/2009/12/passing-data-or-parameter-to-another_02.html this.getIntent().With( intent => { intent.getExtras().With( e => { var keys = e.keySet().toArray(); foreach (string key in keys) { var b = new Button(this).AttachTo(ll); b.WithText(new { key }.ToString()); } } ); } ); this.setContentView(sv); }
protected override void onCreate(Bundle savedInstanceState) { var file1 = "http://a.tumblr.com/tumblr_m8ueqqpyyy1rs64dko1.mp3"; var name1 = "E43 Understanding the Dangers of Ego-Depletion by Tim"; base.onCreate(savedInstanceState); var downloadManager = (DownloadManager)getSystemService(DOWNLOAD_SERVICE); var preferenceManager = PreferenceManager.getDefaultSharedPreferences(this); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new android.widget.Button(this).AttachTo(ll); downloadReceiver = new MyDownloadReceiver { }; // O:\src\AndroidDownloadManagerActivity\Activities\ApplicationActivity___c__DisplayClass2___c__DisplayClass4.java:60: cannot find symbol //symbol : class Button //location: class AndroidDownloadManagerActivity.Activities.ApplicationActivity___c__DisplayClass2___c__DisplayClass4 // ViewExtensions.<Button>WithText(this.CS___8__locals3.b, "Download " + this.CS___8__locals3.name1); // ^ b.WithText("Download " + name1); b.AtClick( v => { b.setText("Downloading..."); b.setEnabled(false); var downloadUri = android.net.Uri.parse(file1); // http://developer.android.com/reference/android/app/DownloadManager.Request.html var request = new DownloadManager.Request(downloadUri); request.setTitle("idea-remixer"); request.setDescription(name1); // W/DownloadManager(15222): Aborting request for download 166: while trying to execute request: // java.net.UnknownHostException: Unable to resolve host "a.tumblr.com": // No address associated with hostname var id = downloadManager.enqueue(request); Toast.makeText(this, new { id, downloadUri }.ToString(), Toast.LENGTH_LONG).show(); //Save the request id //var PrefEdit = preferenceManager.edit(); //PrefEdit.putLong(strPref_Download_ID, id); //PrefEdit.commit(); downloadReceiver.AtReceive = delegate { DownloadManager.Query query = new DownloadManager.Query(); //query.setFilterById(preferenceManager.getLong(strPref_Download_ID, 0)); // http://developer.android.com/reference/android/app/DownloadManager.Query.html#setFilterById(long...) query.setFilterById(new[] { id }); Cursor cursor = downloadManager.query(query); if (cursor.moveToFirst()) { int columnIndex = cursor.getColumnIndex(DownloadManager.COLUMN_STATUS); int status = cursor.getInt(columnIndex); if (status == DownloadManager.STATUS_FAILED) { Toast.makeText(this, new { id, status }.ToString(), Toast.LENGTH_LONG).show(); b.WithText("(failed) Download " + name1); b.setEnabled(true); } else if (status == DownloadManager.STATUS_SUCCESSFUL) { //Retrieve the saved request id //long downloadID = preferenceManager.getLong(strPref_Download_ID, 0); var uri = downloadManager.getUriForDownloadedFile(id); Toast.makeText(this, new { id, uri }.ToString(), Toast.LENGTH_LONG).show(); // jsc ignores this type in import? Button __ref0; b.WithText("Download " + name1); b.setEnabled(true); //ParcelFileDescriptor file; //try //{ // file = downloadManager.openDownloadedFile(downloadID); // //FileInputStream fileInputStream = new ParcelFileDescriptor.AutoCloseInputStream(file); // //Bitmap bm = BitmapFactory.decodeStream(fileInputStream); // //image.setImageBitmap(bm); //} //catch // (FileNotFoundException e) //{ // TODO Auto-generated catch block // //e.printStackTrace(); // throw; //} } } }; } ); this.setContentView(sv); }
protected override void onCreate(Bundle savedInstanceState) { var activity = this; // http://stackoverflow.com/questions/11425020/actionbar-in-a-dialogfragment //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest //activity.requestWindowFeature(Window.FEATURE_ACTION_BAR); //activity.getWindow().setFlags(WindowManager_LayoutParams.FLAG_DIM_BEHIND, WindowManager_LayoutParams.FLAG_DIM_BEHIND); //activity.getWindow().setFlags(WindowManager_LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager_LayoutParams.FLAG_TRANSLUCENT_STATUS); //var @params = activity.getWindow().getAttributes(); ////@params.height = WindowManager_LayoutParams.FILL_PARENT; ////@params.width = 850; //fixed width ////@params.height = 450; //fixed width //@params.alpha = 1.0f; //@params.dimAmount = 0.5f; //activity.getWindow().setAttributes(@params); //activity.getWindow().setLayout(850, 850); base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); // https://stackoverflow.com/questions/1898886/removing-an-activity-from-the-history-stack b.WithText("start secondary"); b.AtClick( v => { foo = "hi"; Intent intent = new Intent(this, typeof(SecondaryActivity).ToClass()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); //intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } ); this.AtPause += delegate { b.setText("AtPause"); }; this.AtResume += delegate { b.setText("AtResume"); }; AtPrepareOptions += value => { value.clear(); var item1 = value.add( (java.lang.CharSequence)(object)"http://abstractatech.com" ); item1.setIcon(android.R.drawable.ic_menu_view); var item2 = value.add( (java.lang.CharSequence)(object)"http://jsc-solutions.net" ); //item2.setIcon(android.R.drawable.ic_menu_edit); item2.setIcon(android.R.drawable.ic_menu_view); var i = new Intent(Intent.ACTION_VIEW, android.net.Uri.parse("http://jsc-solutions.net") ); // http://vaibhavsarode.wordpress.com/2012/05/14/creating-our-own-activity-launcher-chooser-dialog-android-launcher-selection-dialog/ var ic = Intent.createChooser(i, "http://jsc-solutions.net"); item2.setIntent( ic ); }; AtOption += item => { //b.WithText("menu was clicked!" + (string)(object)item.getTitle()); b.WithText("menu was clicked!" + new { item }); }; var b2 = new Button(this); b2.setText("The other button!"); ll.addView(b2); this.setContentView(sv); vConfigurationChanged = e => { var orientation = getScreenOrientation(); var SystemUiVisibility = getWindow().getDecorView().getSystemUiVisibility(); b2.setText( new { orientation, SystemUiVisibility }.ToString() ); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { hideSystemUI(); } else { showSystemUI(); } }; vConfigurationChanged(null); }
protected override void onCreate(Bundle savedInstanceState) { // http://www.mkyong.com/android/android-activity-from-one-screen-to-another-screen/ base.onCreate(savedInstanceState); //this.getWindow().getDecorView() //this.getWindow().setTitle("secondary " + new { ApplicationActivity.foo}); //this.getWindow().setTitleColor(0xff0000); // Set the IMMERSIVE flag. // Set the content to appear under the system bars so that the content // doesn't resize when the system bars hide and show. getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); this.setContentView(sv); var b = new Button(this).AttachTo(ll); b.WithText(" secondary " + new { ApplicationActivity.foo }); b.AtClick( v => { this.finish(); } ); //this.AtPause += delegate //{ // this.finish(); //}; //this.AtWindowFocusChanged += e => // { // if (!e) // this.finish(); // }; //this.AtUserLeaveHint += delegate { this.finish(); }; //this.onfo //this.onWindowFocusChanged //public void onWindowFocusChanged (boolean hasFocus) }
public android.view.View createTabContent(string value) { ScrollView sv = new ScrollView(c); LinearLayout ll = new LinearLayout(c); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); Button b = new Button(c); b.setText("I don't do anything, but I was added dynamically. :)"); ll.addView(b); return sv; }
public android.view.View createTabContent(string value) { ScrollView sv = new ScrollView(c); LinearLayout ll = new LinearLayout(c); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); Button b = new Button(c); b.setText("Yay. This almost works!"); ll.addView(b); return sv; }
public override void InternalBeforeSetContext(android.content.Context c) { InternalElement = new Button(c); InternalSetText(InternalText); InternalAddClick(); }
// https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20151212/androidudpclipboard // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20160101/ovrwindwheelndk // connect s6 via usb . // turn on wifi! // kill adb //"x:\util\android-sdk-windows\platform-tools\adb.exe" tcpip 5555 // restarting in TCP mode port: 5555 //13: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 // inet 192.168.1.126/24 brd 192.168.1.255 scope global wlan0 // valid_lft forever preferred_lft forever // on red // "x:\util\android-sdk-windows\platform-tools\adb.exe" connect 192.168.1.126:5555 // connected to 192.168.1.126:5555 // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201511/20151121 // http://stackoverflow.com/questions/17513502/support-for-multi-window-app-development protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://www.dreamincode.net/forums/topic/130521-android-part-iii-dynamic-layouts/ base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this); b.setText("Vibrate!"); var sw = Stopwatch.StartNew(); Action cleanup = delegate { }; Notification reuse = null; var notificationIntent = new Intent(this, typeof(ApplicationActivity).ToClass()); var contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); Action<string> SetClipboard = value => { Console.WriteLine("SetClipboard " + new { value }); this.runOnUiThread( delegate { cleanup(); b.setText(value); if (reuse != null) { reuse.setLatestEventInfo( this, contentTitle: value, contentText: "", contentIntent: contentIntent); return; } var xNotificationManager = (NotificationManager)this.getSystemService(Activity.NOTIFICATION_SERVICE); // see http://developer.android.com/reference/android/app/Notification.html var xNotification = new Notification( //android.R.drawable.ic_dialog_alert, android.R.drawable.ic_menu_view, //tickerText: "not used?", tickerText: value, when: 0 //java.lang.System.currentTimeMillis() ); //notification.defaults |= Notification.DEFAULT_SOUND; // flags = Notification.FLAG_ONGOING_EVENT var FLAG_ONGOING_EVENT = 0x00000002; //notification.flags |= Notification.FLAG_ONGOING_EVENT; //xNotification.flags |= FLAG_ONGOING_EVENT; xNotification.setLatestEventInfo( this, contentTitle: value, contentText: "", contentIntent: contentIntent); //notification.defaults |= Notification.DEFAULT_VIBRATE; //notification.defaults |= Notification.DEFAULT_LIGHTS; // http://androiddrawableexplorer.appspot.com/ var id = (int)sw.ElapsedMilliseconds; xNotificationManager.notify(id, xNotification); var xVibrator = (Vibrator)this.getSystemService(Context.VIBRATOR_SERVICE); xVibrator.vibrate(600); #region setPrimaryClip android.content.ClipboardManager clipboard = (android.content.ClipboardManager)getSystemService(CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("label", value); clipboard.setPrimaryClip(clip); #endregion reuse = xNotification; cleanup += delegate { // https://developer.android.com/reference/android/app/Notification.html if (xNotification == null) return; xNotificationManager.cancel(id); }; } ); }; b.AtClick( delegate { SetClipboard("hello"); } ); // Z:\jsc.svn\examples\c\android\Test\TestNDKUDP\TestNDKUDP\xNativeActivity.cs #region lets listen to incoming udp // could we define our chrome app inline in here? // or in a chrome app. could we define the android app inline? #region ReceiveAsync Action<IPAddress> f = async nic => { b.setText("awaiting at " + nic); WifiManager wifi = (WifiManager)this.getSystemService(Context.WIFI_SERVICE); var lo = wifi.createMulticastLock("udp:49814"); lo.acquire(); // Z:\jsc.svn\examples\java\android\AndroidUDPClipboard\ApplicationActivity.cs // X:\jsc.svn\examples\java\android\forms\FormsUDPJoinGroup\FormsUDPJoinGroup\ApplicationControl.cs // X:\jsc.svn\examples\java\android\LANBroadcastListener\LANBroadcastListener\ApplicationActivity.cs var uu = new UdpClient(49814); uu.JoinMulticastGroup(IPAddress.Parse("239.1.2.3"), nic); while (true) { // cannot get data from RED? var x = await uu.ReceiveAsync(); // did we jump to ui thread? //Console.WriteLine("ReceiveAsync done " + Encoding.UTF8.GetString(x.Buffer)); var data = Encoding.UTF8.GetString(x.Buffer); // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150704 // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150704/mousedown SetClipboard(data); } }; // WithEach defined at? NetworkInterface.GetAllNetworkInterfaces().WithEach( n => { // X:\jsc.svn\examples\java\android\forms\FormsUDPJoinGroup\FormsUDPJoinGroup\ApplicationControl.cs // X:\jsc.svn\core\ScriptCoreLibJava\BCLImplementation\System\Net\NetworkInformation\NetworkInterface.cs var IPProperties = n.GetIPProperties(); var PhysicalAddress = n.GetPhysicalAddress(); foreach (var ip in IPProperties.UnicastAddresses) { // ipv4 if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { if (!IPAddress.IsLoopback(ip.Address)) if (n.SupportsMulticast) f(ip.Address); } } } ); #endregion #endregion // jsc could pass this ptr to ctor for context.. var t = new EditText(this) { }; t.AttachTo(ll); ll.addView(b); this.setContentView(sv); //this.ShowLongToast("http://my.jsc-solutions.net x"); }
protected override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this).AttachTo(ll); var ip = getLocalIpAddress(); b.WithText("server at " + ip); b.AtClick( v => { var random = new System.Random(); // Error 312 (net::ERR_UNSAFE_PORT): Unknown error. var port = random.Next(1024, 32000); var uri = "http://" + ip; uri += ":"; uri += ((object)(port)).ToString(); b.setText(uri); Toast.makeText( this, "connect to this web server", Toast.LENGTH_LONG ).show(); var ipa = Dns.GetHostAddresses(ip)[0]; Action<string> log = x => Log.wtf("ApplicationActivity", x); // jsc does not import generic param, why? //Action<NetworkStream> AtConnection = NetworkStreamAction AtConnection = s => { //log("AtConnection"); var r = new StreamReader(s); var h0 = r.ReadLine(); //log("ReadLine done"); var m = new MemoryStream(); Action<string> WriteLineASCII = (string e) => { var x = Encoding.ASCII.GetBytes(e + "\r\n"); m.Write(x, 0, x.Length); }; WriteLineASCII("HTTP/1.1 200 OK"); WriteLineASCII("Content-Type: text/html; charset=utf-8"); //WriteLineASCII("Content-Length: " + data.Length); WriteLineASCII("Connection: close"); WriteLineASCII(""); WriteLineASCII(""); WriteLineASCII("<html>"); WriteLineASCII("<body><h1 style='color: red;'>Hello world</h2><h3>jsc</h3><pre>" + h0 + "</pre></body>"); WriteLineASCII("</html>"); log("write done"); var oa = m.ToArray(); s.Write(oa, 0, oa.Length); s.Flush(); s.Close(); }; // AndroidTcpListenerActivity.AndroidActivity 003e create: AndroidTcpListenerActivity.Activities.ApplicationActivity+<>c__DisplayClass8+<>c__DisplayClassb //switch to STA Exception: //System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The IL Generator cannot be used while there are unclosed exceptions. // at System.Reflection.Emit.ILGenerator.BakeByteArray() // at System.Reflection.Emit.MethodBuilder.CreateMethodBodyHelper(ILGenerator il) // at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() // at System.Reflection.Emit.TypeBuilder.CreateType() new Thread( delegate() { var r = new TcpListener(ipa, port); //try //{ r.Start(); while (true) { //log("AcceptTcpClient"); var c = r.AcceptTcpClient(); //log("AcceptTcpClient done, GetStream"); var s = c.GetStream(); //log("AcceptTcpClient done, GetStream done"); new Thread( delegate() { //log("before AtConnection"); AtConnection(s); } ) { IsBackground = true, }.Start(); } //} //catch //{ // log("AcceptTcpClient error!"); // throw; //} } ) { IsBackground = true, }.Start(); } ); var b2 = new Button(this); b2.setText("The other button!"); ll.addView(b2); this.setContentView(sv); }
// http://www.codeproject.com/Tips/623446/Style-Any-Activity-as-an-Alert-Dialog-in-Android // android:theme="@android:style/Theme.Holo.Dialog" protected override void onCreate(global::android.os.Bundle savedInstanceState) { ScriptCoreLib.Android.ThreadLocalContextReference.CurrentContext = this; // X:\jsc.svn\examples\java\android\forms\AndroidFormsActivity\AndroidFormsActivity\ApplicationActivity.cs // cmd /K c:\util\android-sdk-windows\platform-tools\adb.exe logcat // Camera PTP // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new android.widget.Button(this); // jsc is doing the wrong thing here var SDK_INT = android.os.Build.VERSION.SDK_INT; b.setText("Notify! " + new { SDK_INT, android.os.Build.VERSION.SDK }); int counter = 0; // http://stackoverflow.com/questions/12900795/how-to-get-a-pin-number-password-keyboard-in-android //var t = new EditText(this); //t.setInputType(android.text.InputType.TYPE_NUMBER_VARIATION_PASSWORD); //t.setTransformationMethod(android.text.method.PasswordTransformationMethod.getInstance()); //ll.addView(t); // ScriptCoreLib.Ultra ? b.AtClick( delegate { counter++; // X:\jsc.svn\examples\javascript\android\Test\TestPINDialog\TestPINDialog\ApplicationWebService.cs var alertDialog = new AlertDialog.Builder(this); alertDialog.setTitle("Hello world"); alertDialog.setPositiveButton("OK", new xOnClickListener { yield = delegate { b.setText("clicked! " + new { id = Thread.currentThread().getId() }); } } ); var cc = new AndroidFormsActivity.ApplicationControl(); //ScriptCoreLib.Extensions.Android.AndroidFormsExtensions.AttachTo( // cc, // X:\jsc.svn\core\ScriptCoreLibAndroid.Windows.Forms\ScriptCoreLibAndroid.Windows.Forms\Extensions\Android\AndroidFormsExtensions.cs __Control _cc = cc; _cc.InternalSetContext(this); alertDialog.setView(_cc.InternalGetElement()); // skip icons? //alertDialog.setIcon(android.R.drawable.star_off); // can we do async yet? alertDialog.create().show(); } ); ll.addView(b); this.setContentView(sv); // X:\jsc.svn\examples\java\android\HelloOpenGLES20Activity\HelloOpenGLES20Activity\ScriptCoreLib.Android\Shader.cs // Error 1 'FormsMessageBox.Activities.ApplicationActivity' does not contain a definition for 'ShowLongToast' and no extension method 'ShowLongToast' accepting a first argument of type 'FormsMessageBox.Activities.ApplicationActivity' could be found (are you missing a using directive or an assembly reference?) X:\jsc.svn\examples\java\android\FormsMessageBox\FormsMessageBox\ApplicationActivity.cs 80 18 FormsMessageBox //this.ShowLongToast("http://jsc-solutions.net"); }
public override void createAndAttachView(int id, FrameLayout frame) { // http://stackoverflow.com/questions/2761577/android-start-an-intent-into-a-framelayout // http://gamma-point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity#comment-37 // http://stackoverflow.com/questions/4882776/start-another-activity-inside-the-framelayout-of-tabactivity // Caused by: java.lang.RuntimeException: You must attach your view to the given frame in createAndAttachView() //at wei.mark.standout.ui.Window.<init>(Window.java:154) //at wei.mark.standout.StandOutWindow.show(StandOutWindow.java:1078) //at wei.mark.standout.StandOutWindow.onStartCommand(StandOutWindow.java:381) //at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2656) var ll = new LinearLayout( frame.getContext() ); //ll.setAlpha(0.8f); ll.setOrientation(LinearLayout.VERTICAL); #region lltab var lltab = new LinearLayout( frame.getContext() ); lltab.AttachTo(ll); var captionpadding = new TextView(frame.getContext()); captionpadding.setText(" "); // http://stackoverflow.com/questions/3297437/shadow-effect-for-a-text-in-android captionpadding.setShadowLayer(1, 0, 0, Color.WHITE); captionpadding.setTextColor(Color.WHITE); captionpadding.setBackgroundColor(Color.argb(0x7F, 0, 0, 0)); captionpadding.AttachTo(lltab); var caption = new TextView(frame.getContext()); caption.setText("XWidgetsWindow"); // http://stackoverflow.com/questions/3297437/shadow-effect-for-a-text-in-android caption.setShadowLayer(1, 0, 0, Color.WHITE); caption.setTextColor(Color.WHITE); caption.setBackgroundColor(Color.argb(0x7F, 0, 0, 0)); caption.AttachTo(lltab); var close = new TextView(frame.getContext()); close.setText(" x "); // http://stackoverflow.com/questions/3297437/shadow-effect-for-a-text-in-android close.setShadowLayer(1, 0, 0, Color.RED); close.setTextColor(Color.RED); close.setBackgroundColor(Color.argb(0x7F, 0, 0, 0)); close.AttachTo(lltab); close.setClickable(true); close.AtClick( delegate { this.close(id); } ); #endregion //wei.mark.standout.WindowCache r; #region WebView var webview = new WebView(frame.getContext()); //webview.setAlpha(0.8f); //frame.startAnimation(new AlphaAnimation(1f, 0.7f)); // java.lang.NoSuchMethodError: android.webkit.WebView.setAlpha //at PopupWebView.Activities.XWidgetsWindow.createAndAttachView(XWidgetsWindow.java:83) //at wei.mark.standout.ui.Window.<init>(Window.java:142) //at wei.mark.standout.StandOutWindow.show(StandOutWindow.java:1026) //at wei.mark.standout.StandOutWindow.onStartCommand(StandOutWindow.java:381) //at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2043) //at android.app.ActivityThread.access$2800(ActivityThread.java:117) //at android.app.ActivityThread$H.handleMessage(ActivityThread.java:998) //at android.os.Handler.dispatchMessage(Handler.java:99) //at android.os.Looper.loop(Looper.java:123) //at android.app.ActivityThread.main(ActivityThread.java:3687) //at java.lang.reflect.Method.invokeNative(Native Method) //at java.lang.reflect.Method.invoke(Method.java:507) //at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) //at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) //at dalvik.system.NativeStart.main(Native Method) //getWindow().setFlags( // WindowManager_LayoutParams.FLAG_HARDWARE_ACCELERATED, // WindowManager_LayoutParams.FLAG_HARDWARE_ACCELERATED); //setContentView(webview); //webview.getSettings().setSupportZoom(true); //webview.getSettings().setLoadsImagesAutomatically(true); webview.getSettings().setJavaScriptEnabled(true); //webview.getSettings().setBuiltInZoomControls(true); //webview.setInitialScale(1); webview.setWebViewClient(new MyWebViewClient { //__this = this }); webview.setWebChromeClient( new MyWebChromeClient { yield_title = // implicit version does not work? value => { caption.setText(value); PersistentNotifications .Where(k => k.id == id) .WithEach( n => { n.contentText = value; n.Notification.setLatestEventInfo( n.context, n.contentTitle, n.contentText, n.contentIntent ); n.update(); } ); } } ); //webview.getSettings().setSupportZoom(true); //webview.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); //webview.getSettings().setJavaScriptEnabled(true); // no flash in emulator? // works on my phone! // no Flash since android 4.1.0!!! //webview.getSettings().setPluginsEnabled(true); //webview.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON); // OR, you can also load from an HTML string: //var summary = "<html><body>You scored <b>192</b> points.</body></html>"; //webview.loadData(summary, "text/html", null); //Log.i(TAG, "loadUrl"); //var uri = "http://cubiq.org/dropbox/3dcity/"; var uri = "http://abstractatech.com"; webview.loadUrl(uri); #endregion // http://forum.xda-developers.com/showthread.php?t=1688531 var rr = new RelativeLayout(frame.getContext()); rr.setBackgroundColor(Color.argb(0x1F, 255, 255, 255)); webview.AttachTo(rr); var resizer = new Button(frame.getContext()); resizer.setText(".:"); //resizer.setAlpha(0.4f); resizer.setWidth(96); resizer.setHeight(96); resizer.setBackgroundColor(Color.argb(0x7F, 255, 255, 255)); // http://stackoverflow.com/questions/8397152/androidlayout-alignparentbottom-by-code // http://stackoverflow.com/questions/8397152/androidlayout-alignparentbottom-by-code resizer.AttachTo(rr); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT ); //400, 250, p.setMargins(400 - 64, 250 - 64 - 32, 0, 0); resizer.setLayoutParams(p); resizer.setOnTouchListener( new __OnTouchListener { yield = (view, e) => { var ww = getWindow(id); // handle dragging to move var consumed = this.onTouchHandleResize(id, ww, view, e ); { p.setMargins(ww.getWidth() - 64 + 10, ww.getHeight() - 64 - 20, 0, 0); resizer.setLayoutParams(p); } return consumed; } } ); rr.AttachTo(ll); ll.AttachTo(frame); { //Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to wei.mark.standout.StandOutWindow$StandOutLayoutParams //at wei.mark.example.XWidgetsWindow.createAndAttachView(XWidgetsWindow.java:101) //at wei.mark.standout.ui.Window.<init>(Window.java:150) //at wei.mark.standout.StandOutWindow.show(StandOutWindow.java:1078) //at wei.mark.standout.StandOutWindow.onStartCommand(StandOutWindow.java:381) //at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2656) //p.setMargins(ww.getWidth() - 64, ww.getHeight() - 64 - 32, 0, 0); //resizer.setLayoutParams(p); } }
// http://stackoverflow.com/questions/17513502/support-for-multi-window-app-development protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://www.dreamincode.net/forums/topic/130521-android-part-iii-dynamic-layouts/ base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(this); b.setText("Vibrate!"); b.AtClick( async delegate { var vibrator = (Vibrator)this.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(600); // or jump to laptop pointerlock? SwitchToCompiler.Invoke( delegate { // did we jump back to compiler? // UDP? // RSA? } ); // or // [javac] W:\src\ADBSwitchToCompiler\Activities\ApplicationActivity___onCreate_b__0_0_d__MoveNext_0600000f.java:48: error: cannot find symbol //[javac] ApplicationActivity___onCreate_b__0_0_d__MoveNext_0600000f.__workflow(next_0600000f0, ref_awaiter1, ref_compiler2, ref_create_b__0_0_d3); //[javac] ^ // roslyn wont like it? await default(SwitchToCompiler); // X:\jsc.svn\examples\javascript\chrome\extensions\ChromeExtensionHopToTab\ChromeExtensionHopToTab\Application.cs // did we jump back to compiler? // UDP? // RSA? Console.WriteLine("record screen"); Console.WriteLine("pull"); // https://developers.google.com/youtube/v3/code_samples/dotnet } ); ll.addView(b); this.setContentView(sv); //this.ShowLongToast("http://my.jsc-solutions.net x"); }
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); }