xamarin.android

Using C# library with Mono for Android from Java code?

 ̄綄美尐妖づ 提交于 2019-12-18 09:48:31
问题 There is a possibility to use C# library with Mono for Android from Java code? It's possible to do it from Objective-C to C# (MonoTouch) with the "--xcode" flag in the mtouch command. But there is an equivalent in Mono for Android? And there is a reasons to do it? thanks! Gwennin 回答1: [Is it possible to] use C# library with Mono for Android from Java code? Yes. Every Java.Lang.Object subclass has an Android Callable Wrapper generated at build time. The Android Callable Wrapper is present to

Xamarin.Forms Android save image to gallery

旧时模样 提交于 2019-12-18 09:45:28
问题 I have a stream which is the result of taking a photo. I want to save that photo to the users Gallery. I have tried all manner of things but nothing takes... The class I am saving is a plain C# class - it does not inherit form any android types but that could be done if necessary (to fire an intent perhaps - though I tried this and it ended up another rabbit hole) I have tried this: try{ using (FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +

simulate cpu usage in mono for Android

你说的曾经没有我的故事 提交于 2019-12-18 09:34:25
问题 I need to write an application in mono for android(Android+c#.net) to simulate steady cpu usage for certain duration(eg:30%,50%,70%) for 2 sec. I refered below link Simulate steady CPU load and spikes here i can able to steady the system cpu but the same operation not able to do in Android os. Any help can be helpful. Thanks in advance. 回答1: I made a sample project which seems to work fine on my Samsung Galaxy S2 and in the Emulator. https://github.com/Cheesebaron/MonoDroid.CPULoader It just

MonoDroid: Global Error Handler

孤人 提交于 2019-12-18 08:53:18
问题 Is there a way to create a global error handler for MonoDroid? My debugger is broken so I need a way to see the exception info while the application crashes. 回答1: It seems that AndroidEnvironment.UnhandledExceptionRaiser is what you're looking for: //that's a dirty-code example, do not use as-is! :) AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) => { File.AppendAllText("tmp.txt", args.Exception.ToString()); }; 回答2: Most (all?) unhandled exceptions should end up in the Android

Visual Studio not showing installed Android api levels

柔情痞子 提交于 2019-12-18 08:49:34
问题 I am developing an Android app in Visual Studio. In the Android SDK manager, all API's from API level 23 (Android 6.0) to API level 25 (Android 7.1) are installed. But when I open the project properties in Visual Studio, the "Compile using Android version" option is showing apis only till 23(Android 6.0). I want to target 7.1 as most of the smartphones will now have it. There are another problem if I go with Android 6.0. Some packages like Xamarin.Firebase.Messaging fails to install with the

Android speech recognition pass data back to Xamarin Forms

我只是一个虾纸丫 提交于 2019-12-18 07:11:17
问题 im really stuck right now and im quite new to Xamarin. I use Xamarin Forms to develop an App with speech recognition. I created just a simple UI with a button and an entry-box. Working: Press button and show popup with speech recognition read the spoken words into a var Not Working: pass the data back to the Xamarin Forms UI (entry) StartPage.xaml.cs: private void BtnRecord_OnClicked(object sender, EventArgs e) { WaitForSpeechToText(); } private async void WaitForSpeechToText() { EntrySpeech

Insert a Monogame view inside MvvmCross monodroid Activity

风流意气都作罢 提交于 2019-12-18 07:08:53
问题 I'm trying to build a Monogame view inside a RelativeLayout from my MvvmCross monodroid Activity view. An android Activity inherits from Microsoft.Xna.Framework.AndroidGameActivity to be able to run a Monogame inside a RelativeLayout (working). My MvvmCross Activity inherits from MvxBindingActivityView(working). So, I need a way to run the game and bind some datas within the same activity. Thanks in advance for your help. 回答1: Loosely speaking, you can translate any Activity to an MvxActivity

Xamarin proguard.ParseException: Unknown option '' in line 1 of file 'Properties/proguard.cfg'

假如想象 提交于 2019-12-18 06:45:49
问题 I'm trying to use proguard with Xamarin. So I enabled it in project options (checked Enable ProGuard ), and I created a file proguard.cfg in Properties, (as new Text file, is it right?) and checked the BuildAction -> ProguardConfiguration The proguard file contains only a -keep configuration, with a comment. Whether I leave or remove the comment, I always get a parse error on line 1 : # test comment -keep class !android.support.v7.view.menu.**, !android.support.design.internal.NavigationMenu,

Xamarin proguard.ParseException: Unknown option '' in line 1 of file 'Properties/proguard.cfg'

*爱你&永不变心* 提交于 2019-12-18 06:45:48
问题 I'm trying to use proguard with Xamarin. So I enabled it in project options (checked Enable ProGuard ), and I created a file proguard.cfg in Properties, (as new Text file, is it right?) and checked the BuildAction -> ProguardConfiguration The proguard file contains only a -keep configuration, with a comment. Whether I leave or remove the comment, I always get a parse error on line 1 : # test comment -keep class !android.support.v7.view.menu.**, !android.support.design.internal.NavigationMenu,

Creating buttons and button click under recyclerview item when it swiped (swip to dismiss) without using library

有些话、适合烂在心里 提交于 2019-12-18 05:17:11
问题 I am using RecyclerView for showing my list. I implement Swipe to dismiss on the RecyclerView with ItemTouchHelper. The underlying layout is implemented in OnchildDraw method by using canvas. Now I have a problem: I want to set onclick on my icon. By clicking on the icon, I want to do some functions. Here is My class: public class ItemTouchHelperCallback : ItemTouchHelper.SimpleCallback { private ContactSearchedResultAdapter _adapter; private RecyclerView _mRecyclerView; private int