xamarin.android

Get Xamarin Android Device calling ASP.NET Web APi running Localhost

天涯浪子 提交于 2020-01-02 06:58:11
问题 I've managed to use the following guide for enabling my VS2015 Android Emulator access to a ASP.NET WEP API running on my local-host which is great :- http://briannoyesblog.azurewebsites.net/2016/03/06/calling-localhost-web-apis-from-visual-studio-android-emulator/ But i would also like to configure my Xamarin application for enabling my external android device the same access to the web api. At present, when running from device, the webclient makes the request but it never completes, which

Xamarin Forms WebView Check When Website Address Changed

被刻印的时光 ゝ 提交于 2020-01-02 06:34:14
问题 I have the following code that sets up a WebView inside my Xamarin.Forms Cross Platform application: ReportsListWebView = new WebView() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Xamarin.Forms.Color.Transparent }; URLReportsListWebView = new UrlWebViewSource { Url = "http://192.168.0.96/MyWebsite/App/MiniMyWebsite?ActionType=Listing&Params=Reports" }; ReportsListWebView.Source = URLReportsListWebView; grid.Children.Add

Xamarin xml android:onClick callback method

三世轮回 提交于 2020-01-02 06:33:51
问题 This is my XML code: <Button android:text="Button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/MyButton" android:id="@+id/button1" android:onClick="sayHellow" /> //RELEVANT PART And this is my main activity: [Activity(Label = "FFFF", MainLauncher = true, Icon = "@drawable/icon", Theme = "@style/Theme.AppCompat.Light")] public class MainActivity : AppCompatActivity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle);

How to stream data from MediaCodec to AudioTrack with Xamarin for Android

可紊 提交于 2020-01-02 05:38:07
问题 I'm trying to decode a mp3 file and stream it to AudioTrack. It all works fine but causes a lot of GC on the Java side. I've made sure to not allocate memory in my play/stream loop and blame ByteBuffer.Get(byte[], int, int) binding of allocating a temp Java array. Anyone can confirm and/or show a better way of feeding data from MediaCodec to AudioTrack? (I know API 21 introduced AudioTrack.write(ByteBuffer, ...)) Thanks Here is what I do: byte[] audioBuffer = new byte[...]; ... ByteBuffer

Xamarin - is there a way to notify Xamarin.Forms from a native project?

◇◆丶佛笑我妖孽 提交于 2020-01-02 05:20:09
问题 So, I have this code in my native project (Android MainActivity OnCreate), which doesn't do anything: var container = TinyIoCContainer.Current; TinyMessengerHub tmh = (TinyMessengerHub)container.Resolve<ITinyMessengerHub>(); tmh.Subscribe<LocalMessage>((m) => { // this doesn't show Toast.MakeText(this, m.Content, ToastLength.Long); }); Here's where I notify the app using TinyMessenger: [Service(Exported = false), IntentFilter(new[] { "com.google.android.c2dm.intent.RECEIVE" })] class

Camera Preview and OCR

心不动则不痛 提交于 2020-01-02 04:35:10
问题 I am new to android development - I'm using Xamarin. I am trying to write an application that initiates the camera preview, and then constantly scans the incoming frames for text (I am using Xamarin.Tesseract from NuGet). In other words, I don't want to make the user take a photo and then do the OCR analysis, instead I want them to just point the video camera at some paper with text on it, i'll continually do the OCR analysis until I detect the specific text I'm searching for) at which point

MvvmCross 5.4 Crash on app startup with NullRef at ConsoleLogProvider

…衆ロ難τιáo~ 提交于 2020-01-02 04:16:12
问题 I've updated my Xamarin.Android app package MvvmCross from 5.3.2 to 5.4 and app start crashing on startup. Manually I identified that the reason is the linker - I have link SDK libs only option enabled. With the None option it works just fine but makes a twice bigger package. The type initializer for 'MvvmCross.Core.Platform.LogProviders.ConsoleLogProvider' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object 回答1: This is a known bug in

How to show the “internal storage” option in an ActionOpenDocument intent by default

▼魔方 西西 提交于 2020-01-02 04:11:06
问题 I need the user to select a file of a custom filetype that they've dragged onto their android device from windows file explorer, but the internal storage option isn't available by default. When I launch the intent using this: var libraryIntent = new Intent(Intent.ActionOpenDocument); libraryIntent.SetType("application/*"); _activity.StartActivityForResult(libraryIntent, (int)ActivityRequestCode.ImportFeatureCodeLibrary); Android OS (5.1 and 6.0) shows the following screen: The user has to

What contraints should I be aware of to maximize portability of Mono code?

送分小仙女□ 提交于 2020-01-02 03:01:08
问题 I'm interested in writing some cross-platform code using Mono, with a view to targeting mobile iOS and Android runtimes. I've perused the Mono and MonoTouch sites, but don't see anything that specifically advises on methods not to use, or Mono hooks which should be avoided. However, that seems a little too good to be true. What limitations should I be aware of going into this project, to ensure maximum portability of the code? 回答1: API wise you get a very similar base class libraries (BCL)

Error when navigating away from a page with a map on Android, while the on-screen keyboard is visible

六眼飞鱼酱① 提交于 2020-01-02 02:22:06
问题 While testing an Android application that contains a couple of Entry textboxes and a map with geolocation enabled, I found that if I clicked the back button on Android while the on-screen keyboard was up (that is, while inserting text on one of the Entries), the app would crash and I'd get the following exception logged on the debug output: 09-09 00:10:38.187 I/MonoDroid(14174): UNHANDLED EXCEPTION: System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Maps.Android