xamarin.android

Xamarin MvvmCross MvxAppCompatDialogFragment looses BindingContext

寵の児 提交于 2019-12-25 03:59:24
问题 I've been using MvxAppCompatActivity throughout my project, but in this specific case I have to make use of a MvxAppCompatDialogFragment . Unfortunately, in this case I lose the binding context of the ViewModel somehow. MobileTestView [MvxDialogFragmentPresentation] [Register(nameof(MobileScreenTestView))] public class MobileTestView : MvxAppCompatDialogFragment<MobileTestViewModel> ... public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Xamarin.Forms how do I access a public function from another CS file?

旧时模样 提交于 2019-12-25 03:29:35
问题 So I'm new to XF and I'm wondering about AppState / Activity life cycle on Android. The code directly below this is in a file called test.xaml.cs . How the sound works is you can say something like startSound.Play() or startSound.Stop() to start or stop sound in the app. I have noticed a bug that doesn't stop sound when the rest of the app resets via the back button (even though it's held in memory?) public Test() { startSound = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer(); startSound

Xamarin Android: get one app's state information from another

时间秒杀一切 提交于 2019-12-25 03:22:59
问题 I have two Xamarin Android apps -- let's call them "Archy" and "Mehitabel". Archy has some persistent state information (which, let's say for the sake of argument, is in a SQLite DB). If a certain thing happens to Mehitabel, she needs to know a piece of that state information. To accomplish this feat, I have Mehitabel send an intent to Archy. Archy has a broadcast receiver that hears it, gathers the necessary state, and fires a different intent back to Mehitabel. Here's the code from Archy:

WebAuthenticationBroker.AuthenticateAsync in android Xamarin

不羁的心 提交于 2019-12-25 03:08:18
问题 Iam developing a cross platform android app using Xamarin. Currently I am stuck with the WebAuthenticationBroker.AuthenticateAsync method and cannot find anything equivalent to it. Here is something I want to do in android: var broker = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, startUri, endUri); var datax = broker.ResponseData; if (broker.ResponseStatus != WebAuthenticationStatus.Success) await new Windows.UI.Popups.MessageDialog("Invalid username or user

Xamarin C# activity on screen (un)lock event

浪尽此生 提交于 2019-12-25 02:49:07
问题 Just wondering if there is an event In Xamarin for the activity class like OnStart , OnResume , OnPause etc. that gets fired when the user locks or unlocks their screen while the app is open, I've been looking for such an event in documentation etc, but I haven't been able to find it. If there is no such event, then how can we create it? 回答1: Xamarin C# activity on screen (un)lock event you could create a listener class to listen for android lock screen and unlock events,use broadcast to

Oxyplot graph takes up whole screen for display

我们两清 提交于 2019-12-25 02:44:15
问题 I just started using using oxyplot library for my project. I successfully added a donut chart in my project but the problem with this is that it takes up the whole screen to show the graph. Is tried so many way to solve this but none of them worked. Here is my axml: <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" local:layout_behavior="@string/appbar_scrolling_view_behavior" > <OxyPlot.Xamarin.Android.PlotView android:id="@

Xamarin android .axml file loading error : This item doesn't support previewing

假装没事ソ 提交于 2019-12-25 02:27:06
问题 I have installed Xamarin today & when I create a project, everything goes right but when I want to open the .axml file in layout folder, visual studio crashes! nothing happens & speed of the visual studio reduces the PCs performance. the only error that I get is: This item doesn't support previewing! What should I do? Please help... . Thanks 回答1: The xamarin android designer has a lot of problems and a lot of community discussions which can be found : https://forums.xamarin.com/discussion

Programmatically Expand/Collapse Group

心不动则不痛 提交于 2019-12-25 02:24:29
问题 I want to display to the user a list of all the units and all their sub-units to select from in an ExpandableListView where they can check off which ones they want to move. Since it would seem having clickable Views inside of the ListView prevents it from expanding and collapsing as it naturally would, I was going to simply allow the CheckedChange event to expand/collapse based on the groupPosition. But when I change the check on one CheckBox, several or all groups responds instead of just

async method freezes UI

随声附和 提交于 2019-12-25 02:24:11
问题 Expected result : TestAsync is called by UI thread and a worker thread executes LongTask . Actual result : Ui thread executes everything Test : public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // [...] _fab = root.FindViewById<FloatingActionButton>(...); _fab.Click += ((sender, v) => TestAsync("fab")); // [...] } private async void TestAsync(string origin) { await LongTask(); } private async Task LongTask() { while (true) { } //

Monodroid - GC.Collect fails without any reason

 ̄綄美尐妖づ 提交于 2019-12-25 02:20:09
问题 I have an application with 4 tabs (TabActivity). By some reasons I call GC.Collect every time user switches tab (overriding OnPause Activity's method). Sometimes (approximately 1 time from 50-100 calls, but sometimes this happens when application just started) my application hangs in this moment. Here is part of my code: protected override void OnPause(){ base.OnPause(); try{ Android.Util.Log.Info("----","GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);"); GC.Collect(GC.MaxGeneration,