Tag: android

2020.09.01.

Xamarin.Android.SerialPort

This project you can find at: https://github.com/officialdoniald/Xamarin.Android.SerialPort. Serial Port wrapper for Xamarin.Android. If you want to change some feature of the Serial Port, just clone this repo and change it. In the SerialPort project you have to go to the SerialPortWrapper folder and the SerialPort.cs. After the update you have to Rebuild, and if you want to use the recently updatet SerialPort class, you have […]

2020.09.01.

Xamarin.Android.CanBus

This project you can find at: https://github.com/officialdoniald/Xamarin.Android.Canbus. Usage: Don’t forget to copy the lib folder to your project! First step: copy the lib folder to you project. You have to change the Properties of theese files: libcanbus.so: AndroidNativeLibrary canbus_helper.jar: AndroidJavaLibrary canbus_micro_fixed.jar: AndroidJavaLibrary Create Canbus: Canbus _canbus = _canbus = new Canbus(250000); _canbus.PackageReceive += Canbus_PackageReceive; _canbus.CanbusStatusChanged += Canbus_CanbusStatusChanged; _canbus.CanbusExceptionOccour += Canbus_CanbusExceptionOccour; Read from the Canbus: Sending […]

2020.09.01.

Xamarin.Forms – change cursor’s color – Android

This code (https://github.com/officialdoniald/Xamarin.Forms.CustomControls/blob/master/XamarinForms.CustomControls/XamarinForms.CustomControls.Android/CustomRenderer/CustomEntryRenderer.cs ) : IntPtr IntPtrtextViewClass = JNIEnv.FindClass(typeof(TextView)); IntPtr mCursorDrawableResProperty = JNIEnv.GetFieldID(IntPtrtextViewClass, “mCursorDrawableRes”, “I”); will change the cursor’s color. If you want to really change the color of the cursor, you have to create in the Resources/Drawable folder a my_cursor.xml file: https://github.com/officialdoniald/Xamarin.Forms.CustomControls/blob/master/XamarinForms.CustomControls/XamarinForms.CustomControls.Android/Resources/drawable/my_cursor.xml <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <solid android:color=”@color/colorCursors”></solid> <size android:width=”2dp” /> </shape> @color/colorCursors is a color from the Resources/values/color.xml. If you don’t have this file, […]

2020.09.01.

Xamarin.Forms – NavigationPage Horizontal Alignment Center Title on Android

This project, you can find at: https://github.com/officialdoniald/Xamarin.Forms.CustomControls We have to create some platforms specific code (custom NavigationPage Renderer), because in the base Xamarin.Forms code, we can’t find this implementation. So first step, we have to create a class in the .NET Standard/PCL project: CustomNavigationPage ( https://github.com/officialdoniald/Xamarin.Forms.CustomControls/blob/master/XamarinForms.CustomControls/XamarinForms.CustomControls/NavigationPage/CustomNavigationPage.cs ). using Xamarin.Forms; using XamarinForms.CustomControls.Enums; namespace XamarinForms.CustomControls.NavigationPage { public class CustomNavigationPage : Xamarin.Forms.NavigationPage { public CustomNavigationPage() : base() { […]