For the needs of our application, we need to detect if a new fingerprint has been added in the system. Using the FingerprintManager, it seems we can only see if the device supports it or if it has any enrolled fingerprints. I'd like to know if there's a way to detect that ?
How to detect new added fingerprint ?
Generic pull to refresh
Hi,
I have a bunch of views using misc. controls, tableview for instance.
Is there a way to easily integrate pull-to-refresh on those tableview ?
I tried to put the table view within a list view, but the rendering of the table view is not ok.
Any ideas ? I searched on google but can't find pull-to-refresh outside the listview
How to cast C# interface to Java.Lang.Object?
Hi All,
Currently, I am working on IEGL10 in Xamarin. I have implemented ISurfaceHolderCallback and on SurfaceCreated(ISurfaceHolder holder) I have to call a method like this.
public void SurfaceCreated(ISurfaceHolder holder)
{
mEglSurface = mEgl.EglCreateWindowSurface(mEglDisplay, mEglConfig,
holder, null);
}
The problem is, the holder is a C# interface and EglCreateWindowSurface requires Java.Lang.Object. So how can I do the casting? If I directly cast holder like (Java.Lang.Object)holder. It is throwing invalid cast exception. Please help guys I am really stuck here.
Xamarin.Forms + MemoryMappedFiles
Hi!
some time ago i tried to use MemoryMappedFiles on MacOS.
Creating a new was no problem but open an existing threw a NotImplementedExpetion.
Last time the answer was it will be supported with Mono 5.4 - well now I tried it again (Mono 5.4.1.6) but I run into same exception.
Maybe someone can help me? - thanks
Hi i am new to Arcore in xamarin android native by make use of visual studio 2015.
so please help me to develop the sample Arcore Projects
without using xlabs and custom render ,how to use radio button ?
without using xlabs and custom render ,how to use radio button ?
Android Oreo Notification Channels
Have you tried using Android Oreo's Notification Channels yet?
If you haven't, read our blog for a quick primer on Notification Channels and let us know what you think!
Feel free to discuss this post below.
Problem with C# layout
Hey Developer!
yesterday i made a post where i asked how to add elements to an excisting layout, now i have another problem
i can only add one label to a stacklayout when i do this:
foreach (var user in werknemer._werknemers)
{
StackLayoutPeople.Children.Add(new Frame
{
Content = new Label { Text = user.Voornaam }
});
}
i seem to get an error everytime i try to add something
(i'm a rookie when it comes to C# layout)
XCode 9.1 Error with Device Agent
After upgrading to XCode 9.1 I can't get Device Agent to deploy to the simulator or a real device. Reverting back to 9.0.1 fixed the issue.
Is anyone else experiencing this?
Mark
Permissions Plugin for Xamarin (Simplifying Runtime Permissions)
Just released my latest plugin to request permissions from shared code! Checkout my blog for details
Code: https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Permissions
NuGet: http://www.nuget.org/packages/Plugin.Permissions
Example:
try
{
var status = await CrossPermissions.Current.CheckPermissionStatus(Permission.Location);
if (status != PermissionStatus.Granted)
{
if(await CrossPermissions.Current.ShouldShowRequestPermissionRationale(Permission.Location))
{
await DisplayAlert("Need location", "Gunna need that location", "OK");
}
var results = await CrossPermissions.Current.RequestPermissions(new[] {Permission.Location});
status = results[Permission.Location];
}
if (status == PermissionStatus.Granted)
{
var results = await CrossGeolocator.Current.GetPositionAsync(10000);
LabelGeolocation.Text = "Lat: " + results.Latitude + " Long: " + results.Longitude;
}
else if(status != PermissionStatus.Unknown)
{
await DisplayAlert("Location Denied", "Can not continue, try again.", "OK");
}
}
catch (Exception ex)
{
LabelGeolocation.Text = "Error: " + ex;
}
Help how do I unit test, everything gives an error?
Hello, I want to add unit tests to my Forms app. The app is made with the MVVM Pattern. I only have a simple unit test like:
`
[ Test() ]
public void TestCase()
{
OrderListViewModel o = new OrderListViewModel();
Assert.AreNotEqual(o, "");
}
`
When running the test everything in my App solution will give an error. The errors are mostly "Error CS0246: The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (App.Tests)"
I am using VS Mac and my testing framework is nunit. Does anyone know why I get all these errors? When running the app everything works fine.
XAML & Future WYSIWYG GUI tool
Is it safe to assume that there will be an Xamarin Forms WYSIWYG editing tool similar to Xamarin iOS and Android's? If so, then it would be prudent to do everything in raw XAML right now eh?
Animation before model update
Hello, thanks to all for reading my question.
I'm using MVVM model. I have an image on my main xaml page, with a binding in source property. So. When model update, image changes.
That works. Then, I wanna do an animation before source update event. I want my first image spins (Rotate on Y axis), and then update it to the new image from model.
I have been try with behaviors, not working, with triggers, not working, with datatrigger. Last one was my best option, but, I don't have RotatetoY in Setters, so, not working.
Can anybody give me a tip about how I can do this animation?
Thanks in advance.
Ipo.
Drawer Layout Exist both in Xamarin.Android.Support.Core.UI and Xamarin.Android.Support.V4
I am a newbie in Xamarin with Visual Studio 2015. I have created project with Android Support V4 and V7 earlier, and it's work fine. But after i add components from Google Play Service MAP, then all my V4 objects get errors. For instance my drawer layout, this is the error :
Severity Code Description Project File Line Suppression State Error CS0433 The type 'DrawerLayout' exists in both 'Xamarin.Android.Support.Core.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' gtSMobileAndroid \Source_eMedWeb\gotoSehat\gtSMobileAndroid\gtSMobileAndroid\MainActivity.cs 20 Active
I have done many things to recover, deleting all packages and reinstall the components, but still i get this error.
Please advice.............thank you very much in advance.......
Customize ImageEntry in xamarin forms
Hi Xamarin Friends Today i have to creating custom image entry but im stuck this point
"DebugType" parameter is not supported by the "XamlCTask" task problem...again
Ok, this is becoming annoying. Almost every existing Xamarin project is broken and even if I manage to fix it, two days later it will break again.
The error is cryptic.
It offers no solution.
I want to disable it.
Advice is needed.
label text not loading Properly on scrolling of ListView Xamarin Form.
Dear All,
Inside ListView we have Usage 4 label and 3 Images. When We fast Scrolling then some of text not showing properly. inside a ListView please help how to solve this. here is my XAML Code.
<ListView.ItemTemplate>
<ViewCell.View>
<Grid BackgroundColor="#EAEBED" RowSpacing="0" ColumnSpacing="0" HeightRequest="50">
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="2*" ></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Source="{Binding UserImage}" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" HorizontalOptions="Center" ></Image>
<Label Text="{Binding Name}" TextColor="Black" FontSize="11" FontAttributes="Bold" Grid.Row="0" Grid.Column="1" HorizontalOptions="StartAndExpand" VerticalOptions="Center" >
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding navmesagescreen}" NumberOfTapsRequired="1" />
</Label.GestureRecognizers>
</Label>
<Label Text="{Binding Text}" TextColor="Black" FontSize="9" FontAttributes="Bold" Grid.Row="1" Grid.Column="1" HorizontalOptions="StartAndExpand" VerticalOptions="Start" >
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding navmesagescreen}" NumberOfTapsRequired="1" />
</Label.GestureRecognizers>
</Label>
<Grid Grid.Column="2" Padding="0,0,2,0" Grid.Row="0" >
<Label Text="{Binding Date}" TextColor="Black" FontSize="8" FontAttributes="Bold" HorizontalOptions="EndAndExpand" VerticalOptions="End" ></Label>
</Grid>
<Grid Grid.Column="2" Padding="0,0,2,0" Grid.Row="1" >
<Label Text="{Binding Time}" TextColor="Black" FontSize="8" FontAttributes="Bold" HorizontalOptions="EndAndExpand" VerticalOptions="Start" ></Label>
</Grid>
<BoxView HeightRequest="500" WidthRequest="1" BackgroundColor="Black" Grid.Row="0" Grid.Column="3" Grid.RowSpan="2" HorizontalOptions="Start"></BoxView>
<Image Source="{Binding flag}" Grid.Row="0" Grid.Column="3" HorizontalOptions="Center" />
<BoxView HeightRequest="1" WidthRequest="250" BackgroundColor="Gray" Grid.Row="0" Grid.Column="3" HorizontalOptions="Start" VerticalOptions="End"></BoxView>
<Image Source="{Binding Alerticon}" Grid.Row="1" Grid.Column="3" HorizontalOptions="Center" >
</Image>
</Grid>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
System.Net.WebException Error: NameResolutionFailure
I periodically get this exception thrown from an android app I am writing side by side with an iOS application. At first, I thought it was a problem with my service being down but, I no longer think this is the case (I never un into the exception in iOS and it is running the EXACT same code). It may or may not matter, but this is running on a Nexus 4 with Android 4.3.
Any ideas as to why this error would happen, and why it would be random?
The stack trace looks like this...
{System.Net.WebException: Error: NameResolutionFailure
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.0-branch/b76e8ec4/source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:945
at IMI.Webstore.Mobile.Core.RestClient.WebRequestExtensions.GetResponse (System.Net.WebRequest request) [0x00033] in c:\Users\jkrebs\code\3Wire\WebStore-Main\WebStoreMobile\Common\IMI.Webstore.Mobile.Core\RestClient\WebRequestExtensions.cs:23
at IMI.Webstore.Mobile.Core.RestClient.RestClient.MakeRequestSynchronous[Part] (System.String requestUrl, System.String verb, System.Object bodyContent) [0x00071] in c:\Users\jkrebs\code\3Wire\WebStore-Main\WebStoreMobile\Common\IMI.Webstore.Mobile.Core\RestClient\RestClient.cs:107 }
How can i read ms access database file .accdb
How can i read and write data to ms access database .accdb file from android app.
Record and Save .Wav with Android AudioRecorder
Hi i am trying to record audio and and trying to save it as .wav format. i am able to record, saving and playing using AudioTracker but i am not able to play .wav format file in my mobile.
Here is my code can any one help to achieve it.
Thanks in advance....
public class TestRecord : Activity
{
Button startRec, stopRec, playBack;
AudioRecord audRecorder;
AudioTrack audioTrack;
volatile bool _isRecording = false;
private byte[] audioBuffer;
private int audioData;
string wavPath = Android.OS.Environment.ExternalStorageDirectory.Path+"/"+System.String.Format("AudioRecorder.wav");
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
startRec = FindViewById<Button> (Resource.Id.startrec);
stopRec = FindViewById<Button> (Resource.Id.stoprec);
playBack = FindViewById<Button> (Resource.Id.playback);
startRec.Click += (sender, e) =>
{
_isRecording = true;
new Thread ( delegate()
{
RecordAudio();
}).Start();
startRec.Enabled = false;
stopRec.Enabled = true;
playBack.Enabled = true;
};
stopRec.Click += (sender, e) =>
{
if(_isRecording == true)
{
_isRecording = false;
audRecorder.Stop ();
audRecorder.Release();
startRec.Enabled = false;
stopRec.Enabled = false;
}
};
playBack.Click += (sender, e) =>
{
byte[] fileData = File.ReadAllBytes (wavPath);
new Thread ( delegate()
{
PlayAudioTrack(fileData);
}).Start();
startRec.Enabled = false;
stopRec.Enabled = false;
playBack.Enabled = false;
};
}
public void RecordAudio()
{
System.IO.Stream outputStream = System.IO.File.Open (wavPath, FileMode.Create);
BinaryWriter bWriter = new BinaryWriter(outputStream);
audioBuffer = new byte[8000];
audRecorder = new AudioRecord(
// Hardware source of recording.
AudioSource.Mic,
// Frequency
11025,
// Mono or stereo
ChannelIn.Mono,
// Audio encoding
Android.Media.Encoding.Pcm16bit,
// Length of the audio clip.
audioBuffer.Length
);
long totalAudioLen = 0;
long totalDataLen = totalAudioLen + 36;
long longSampleRate = 11025;
int channels = 2;
long byteRate = 16 * longSampleRate * channels/8;
totalAudioLen = audioBuffer.Length;
totalDataLen = totalAudioLen + 36;
WriteWaveFileHeader(
bWriter,
totalAudioLen,
totalDataLen,
longSampleRate,
channels,
byteRate);
audRecorder.StartRecording();
while (_isRecording == true)
{
try
{
/// Keep reading the buffer while there is audio input.
audioData = audRecorder.Read(audioBuffer, 0, audioBuffer.Length);
bWriter.Write(audioBuffer);
}
catch (System.Exception ex)
{
System.Console.Out.WriteLine(ex.Message);
break;
}
}
outputStream.Close();
bWriter.Close();
}
void PlayAudioTrack(byte[] audBuffer)
{
audioTrack = new AudioTrack(
// Stream type
Android.Media.Stream.Music,
// Frequency
11025,
// Mono or stereo
ChannelOut.Mono,
// Audio encoding
Android.Media.Encoding.Pcm16bit,
// Length of the audio clip.
audBuffer.Length,
// Mode. Stream or static.
AudioTrackMode.Stream);
audioTrack.Play();
audioTrack.Write(audBuffer, 0, audBuffer.Length);
}
private void WriteWaveFileHeader(
BinaryWriter bWriter, long totalAudioLen,
long totalDataLen, long longSampleRate, int channels,
long byteRate)
{
byte[] header = new byte[44];
header[0] = (byte)'R'; // RIFF/WAVE header
header[1] = (byte)'I';
header[2] = (byte)'F';
header[3] = (byte)'F';
header[4] = (byte) (totalDataLen & 0xff);
header[5] = (byte) ((totalDataLen >> 8) & 0xff);
header[6] = (byte) ((totalDataLen >> 16) & 0xff);
header[7] = (byte) ((totalDataLen >> 24) & 0xff);
header[8] = (byte)'W';
header[9] = (byte)'A';
header[10] = (byte)'V';
header[11] = (byte)'E';
header[12] = (byte)'f'; // 'fmt ' chunk
header[13] = (byte)'m';
header[14] = (byte)'t';
header[15] = (byte)' ';
header[16] = 16; // 4 bytes: size of 'fmt ' chunk
header[17] = 0;
header[18] = 0;
header[19] = 0;
header[20] = 1; // format = 1
header[21] = 0;
header[22] = (byte) channels;
header[23] = 0;
header[24] = (byte) (longSampleRate & 0xff);
header[25] = (byte) ((longSampleRate >> 8) & 0xff);
header[26] = (byte) ((longSampleRate >> 16) & 0xff);
header[27] = (byte) ((longSampleRate >> 24) & 0xff);
header[28] = (byte) (byteRate & 0xff);
header[29] = (byte) ((byteRate >> 8) & 0xff);
header[30] = (byte) ((byteRate >> 16) & 0xff);
header[31] = (byte) ((byteRate >> 24) & 0xff);
header[32] = (byte) (2 * 16 / 8); // block align
header[33] = 0;
header[34] = 16; // bits per sample
header[35] = 0;
header[36] = (byte)'d';
header[37] = (byte)'a';
header[38] = (byte)'t';
header[39] = (byte)'a';
header[40] = (byte) (totalAudioLen & 0xff);
header[41] = (byte) ((totalAudioLen >> 8) & 0xff);
header[42] = (byte) ((totalAudioLen >> 16) & 0xff);
header[43] = (byte) ((totalAudioLen >> 24) & 0xff);
bWriter.Write(header, 0, 44);
}
}