ListViewAdapter.IsEnabled android.runtime.JavaProxyThrowable: System.NullReferenceException: Object
encoding 1252 data could not be found
Hi,
I'm getting a "1252 encoding not found" error on an Android device in release mode (in debug mode everything is fine).
I'm using Visual Studio 2015.
I think the error occurs when trying to setup a connection to sql server.
Googling for an answer, I found a solution : Android project properties, Android Options, Linker tab, check "West" at additional supported encodings. And it worked! However, then I published a newer version of the app (with the "West" checked), but now I get the "1252 encoding not found" again. No matter what I do, I can't get rid of it.
Please help.
Why I get This Error?
> Can't load types from xmlns http://schemas.microsoft.com/winfx/2006/xaml/presentation TaskX.UWP C:\Users\M\source\repos\TaskX\TaskX\TaskX\New.xaml
This is my full code:
<?xml version="1.0" encoding="utf-8" ?>
After upgrading to Forms 2.5-stable: Version conflict detected for Xamarin.Android.Support.v4
Hey!
After upgrading to Xamarin Forms 2.5-stable, I now get the following error in my project.
Error NU1607 Version conflict detected for Xamarin.Android.Support.v4. Reference the package directly from the project to resolve this issue.
MyProject.Android (>= 1.0.0) -> MyProject (>= 1.0.0) -> Xamarin.Forms (>= 2.5.0.77107) -> Xamarin.Android.Support.v4 (>= 25.4.0.2)
MyProject.Android (>= 1.0.0) -> MyProject (>= 1.0.0) -> Xamarin.Auth (>= 1.5.0.3) -> Xamarin.Android.Support.CustomTabs (>= 23.3.0) -> Xamarin.Android.Support.v4 (>= 23.3.0).
I'm using netstandard 2.0 in my class library project.
What I've tried:
Tried to install Xamarin.Android.Support.v4 to my Android project, but the installation fails with the following message:
Version conflict detected for Xamarin.Android.Support.Core.UI. Reference the package directly from the project to resolve this issue.Reinstalled Xamarin.Forms
Any ideas?
ValueConverter with Bindable Property
I have a Xamarin project, and I am trying to get a binding on my ValueConverter. I accomplish this in my UWP project, but in Xamarin I am getting a compilation error:
No property, bindable property, or event found for 'UserData', or mismatching type between value and property.
The purpose of this is that when you select an item in the ListView, the entry reads the UserValue property, when you edit the text in this entry, the content of the item's property is updated, and this change is visible in the ListView.
There is my code:
MainPage.XAML:
<ListView x:Name="_ListView" ItemSelected="_ListView_ItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Grid.Resources>
<local:ViewCell_Converter x:Key="ViewCell_Converter" UserData="{Binding}"/>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding UserName}"/>
<Label Grid.Column="1" Text="{Binding UserValue, Converter={StaticResource ViewCell_Converter}}"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
MainPage.XAML.cs:
public MainPage()
{
InitializeComponent();
_ListView.ItemsSource = UserDatas();
}
private ObservableCollection<UserData> UserDatas()
{
return new ObservableCollection<UserData>()
{
new UserData() { UserName = "Name1", UserValue = 10, ValidatedByUser = true, },
new UserData() { UserName = "Name2", UserValue = 11, ValidatedByUser = false, },
new UserData() { UserName = "Name3", UserValue = 12, ValidatedByUser = true, },
new UserData() { UserName = "Name4", UserValue = 13, ValidatedByUser = false, },
new UserData() { UserName = "Name5", UserValue = 14, ValidatedByUser = true, },
};
}
private void _ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem is UserData userData)
{
Entry_NewValue.Text = userData.UserValue.ToString();
}
}
private void Entry_NewValue_TextChanged(object sender, TextChangedEventArgs e)
{
if (_ListView.SelectedItem is UserData userData)
{
if (double.TryParse(Entry_NewValue.Text, out double _double))
{
if(userData.UserValue != _double)
{
userData.UserValue = _double;
}
}
}
}
Methods.cs:
public class UserData : Prism.Mvvm.BindableBase
{
private bool _validatedByUser;
public bool ValidatedByUser
{
get
{
return _validatedByUser;
}
set
{
SetProperty(ref _validatedByUser, value);
}
}
private string _userName;
public string UserName
{
get
{
return _userName;
}
set
{
SetProperty(ref _userName, value);
}
}
private double _userValue;
public double UserValue
{
get
{
return _userValue;
}
set
{
SetProperty(ref _userValue, value);
}
}
}
public class ViewCell_Converter : BindableObject, IValueConverter
{
public UserData UserData
{
get { return (UserData)GetValue(bindableProperty); }
set { SetValue(bindableProperty, value); }
}
public static readonly BindableProperty bindableProperty = BindableProperty.Create(
nameof(UserData),
typeof(UserData),
typeof(ViewCell_Converter),
null);
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (UserData != null)
{
if (value is double _value)
{
if (UserData.ValidatedByUser)
{
return string.Format("{0:0.00}", _value);
}
else
{
return string.Format("{0:0.0000}", _value);
}
}
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
AutocompleteBar Control
I'm attempting to make a control for an Autocomplete Bar and I thought I had it as it works perfect on iOS but not so on Android. Within my control, I'm trying to put a rounded Frame behind the SearchBar to give it a rounded look, shadow, etc. and my code works fine on iOS but on Android the Frame overlays the search bar no matter what I try. I can't explicitly define the Z axis coordinates anywhere from the look of it as it's supposed to be implicit in the order but that doesn't seem to be working. Code posted below:
<Grid Margin="6" Grid.Row="0" Grid.Column="0">
<Frame BackgroundColor="{StaticResource ColorCard}"
CornerRadius="16" BorderColor="{StaticResource ColorTextPrimary}" />
<SearchBar x:Name="mSearchBar" BackgroundColor="Transparent"
Placeholder="Search" PlaceholderColor="{StaticResource ColorTextSecondary}"
TextColor="{StaticResource ColorTextPrimary}"
SearchButtonPressed="Handle_SearchButtonPressed"
TextChanged="Handle_TextChanged" />
</Grid>
HOW TO ACCESS THE FILE PATH IN IOS DEVICE
Hi,
I'm working for download/upload files like image, docs and video in Xamarin.Forms IOS. I use PCLStorage from Nuget. My question is that how can I access the filepath like this:
this path is on my emulator in Mac:
/Users/mac-name/Library/Developer/CoreSimulator/Devices/138067AE-00A4-4B9B-BCDA-15133F13A/data/Containers/Data/Application/850D57E6-50AD-40D0-A5E3-30745C21/Documents/../Library/ImageTest
I've see the image save in this path in imac folder.
this path is in my iphone:
/var/mobile/Containers/Data/Application/9B119CB1-47AD-49B9-80B3-7228D52C/Documents/../Library/ImageTest
I want also to see this in folder files/ or File Manager in Iphone like android.
If anyone of you guys who already tried this or any best way to fix my issue please give some advice.
Thanks in advance!
Run App on externally installled ios simulator
I am doing an xamarin forms app. The inbuilt ios simulator in visual studio15.7.6 runs very slowly. The connected mac has only 4Gb Ram. Can i speed up the performance by running code on externally installed ios simulator on windows10 ? I have downloaded and installed a custom ios simulator but not showing in the connected devices list ?
Xamarin.Forms CardsView nuget package
Hi all) I've released new package for Xamarin.Forms (Something like Tinder's CardsView)
Maybe, someone will be interested in it
nuget.org/packages/CardsView/ -- nuget
github.com/AndreiMisiukevich/CardView -- source and samples
EventToCommand with Xamarin Forms Behaviors
I wrote an EventToCommand behavior using Xamarin Forms 1.3 behaviors and I would like to share it with you : anthonysimmon.com/eventtocommand-in-xamarin-forms-apps/
You will find an example where the EventToCommand is bound to the ItemTapped of a ListView so that we can get the tapped item data context inside a command of the ListView data context:
<ListView ItemsSource="{Binding People}">
<ListView.Behaviors>
<b:EventToCommandBehavior EventName="ItemTapped" Command="{Binding SayHelloCommand}" EventArgsConverter="{StaticResource ItemTappedConverter}" />
</ListView.Behaviors>
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Name}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
set custom font in webview
I want to set my own custom font in webview.
WebView Description = new WebView(this.Context); WebSettings settings = Description.Settings; settings.FixedFontFamily = "DIN-Condensed-Bold.ttf";
I have added my Font called DIN-Condensed-Bold.ttf in Assets/fonts folder, but I don`t see the effect.
Is it build action problem? How can I implement it?
Azure SQL Database without an Azure App Service plan ?
Hi !
I want to build a Xamarin.Forms app using only one Azure SQL Database.
My question is : is it possible to use an Azure database without an App Service subscription ? I just want to pay for the database (I have a small budget).
If it is, I was not able to find a proper tutorial describing how to connect to this database (all tutorial show how to use the database with App Service)
Thanks !
VideoPlayer xamarin forms
Hi xamarin forum
Can anyone give a suggestion where can I find a video player that
1. Can play my video from database using file path
2. can really work on both iOS and Android
I said the number 2 because I am currently using the sample code that is written here
https://developer.xamarin.com/samples/xamarin-forms/customrenderers/VideoPlayerDemos/
but when I tried in my iOS device it crashes my app but when I use it in my Android device all works fine @BillyLiu (Thanks for all the help dude! Cheers!)
Unable to activate instance of type Xamarin.Forms.Platform.Android.ListViewAdapter
I don't know why I am getting this error. I am using MVVM and a listview. What I am trying to use is that I am fetching some info from Backend with the help of MVVM. I want that my listview should be updated when I am adding an item. Everything is working fine except the listview, neither it is updated nor unable to remove an item.
Here is my code
List<string> items = new List<string>();
ObservableCollection<UserCartDetails> cart_response = new ObservableCollection<UserCartDetails>();
ShoppingServices shoppingServices = new ShoppingServices();
//UserCartDetails Item = new UserCartDetails();
public static Context _context = Android.App.Application.Context;
#region "Refreshing Data"
private bool isLoading;
private bool isRefreshing;
public bool IsLoading
{
get
{
return this.isLoading;
}
set
{
this.isLoading = value;
RaisePropertyChanged("IsLoading");
}
}
public bool IsRefreshing
{
get
{
return this.isRefreshing;
}
set
{
this.isRefreshing = value;
RaisePropertyChanged("IsRefreshing");
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void RaisePropertyChanged(string propName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propName));
}
}
public Command RefreshCommand
{
get
{
return new Command(async () =>
{
await BindData();
});
}
}
#endregion
private async Task BindData()
{
//cart_response.Clear();
var response1 = shoppingServices.GetCartDetail(BaseClass.UserId, BaseClass.Kitchen_Id, BaseClass.Token);
if (response1.success == "True")
{
Device.BeginInvokeOnMainThread(() =>
{
cart_response = response1.parameters;
ResponseList.ItemsSource = cart_response;
});
// cart_response = response1.parameters;
}
IsLoading = false;
IsRefreshing = false;
}
private async void Button_Click(object sender, EventArgs e)
{
IsLoading = true;
data.IsVisible = true;
string name = entry_name.Text;
string quantity = WeightList.SelectedItem.ToString().Split(' ')[0];
var response = shoppingServices.CartDetail(BaseClass.UserId, BaseClass.Kitchen_Id, name, quantity, BaseClass.Token);
if (response.success == "True")
{
await Task.Run(async () => { await BindData(); });
//await BindData();
}
}
void OnTapGestureRecognizerTapped2(object sender, EventArgs e)
{
//var item = (Xamarin.Forms.Image)sender;
int cart_id = Convert.ToInt32(((Xamarin.Forms.TappedEventArgs)e).Parameter);
var response = shoppingServices.RemoveCartDetail(BaseClass.UserId, cart_id.ToString(), BaseClass.Token);
if (response.success == "True")
{
Toast.MakeText(_context, response.message, ToastLength.Long).Show();
cart_response.Clear();
ResponseList.ItemsSource = cart_response;
if(ResponseList.ItemsSource==null)
{
ResponseList.IsVisible = false;
}
else
{
var response1 = shoppingServices.GetCartDetail(BaseClass.UserId, BaseClass.Kitchen_Id, BaseClass.Token);
if (response1.success == "True")
{
cart_response = response1.parameters;
ResponseList.ItemsSource = cart_response;
}
}
}
else
{
Toast.MakeText(_context, response.message, ToastLength.Long).Show();
}
}
Button Text alignment
Is there a way to change the text alignment in Button? I want to fix the alignment and color of the button for the entire app.
Thanks in advance
Display Alert
Hi All,
I am using DisplayAlert for popup messages,In Ios it is fine
But in android button(cancel) is always in capital letters. how to have cancel button with small letters
Thankyou
SQLite.net NullReferenceException whilst following provided Xamarin example(s)
Hey guys,
Me again, with a different question about a different subject; SQLite.
I've got quite good skills in scripting SQL queries, but I'm struggling to connect my XamarinForms (Portable) solution to a local database.
I've followed the guide provided by Xamarin and their example on Github.
However, as mentioned I'm having some issues with connecting my already created solution with the database. Debugging my solution gives me nothing except an error message:
System.NullReferenceException: Object reference not set to an instance of an object.
in my for loop (looping through every object in a list of objects ):
foreach (Foundation found in result) { await App.Database.SaveItemAsync(found); count++; Debug.WriteLine(count.ToString()); }
result
is the resulting set (List) from a call to a RESTful Api that most assuredly is NOT null, and is invoked after the result
has been assigned to.
The reference to App.Dabatase.SaveItemAsync()
is linked similar to the provided github example mentioned above.
Here is a linkto my project on Github. For the full source code, please see the referred Github link provided in previous sentence as it would be too much to write it all here.
The relevant files are App.cs, Data -> FoundationsDatabase.cs and GetFoundationsPage.cs
How to remove AppBar/Toolbar in WPF application in Xamarin.forms?
Hi,
I've integrated WPF project with Xamarin forms cross platform solution.
refer for integration => (https://c-sharpcorner.com/article/create-wpf-application-using-xamarin-forms/)
I want to remove the Additional AppBar/ToolBar that appears below the TitleBar when the WPF application is built and run.
That is shown in the image below
Thanks.
Return to same page when app is back into foreground.
Hi,
The main page of my app is subscribed to receiving push notifications. When the app is in the foreground, the notification data is displayed on the page(when notification comes in).
When the app is in the background I want that when the user clicks the notification, the page with the push notification information is loaded.
If the page is in the background, is it still subscribed to receiving notifications and thus still receives notifications? Or clicking the notification in the notification tray just load a new page, re-subscribes and has missed the previous notification information?
How can I achieve this? Thank you in advance.
Xamarin Forms iphone simulator filenotfoundexception resources.dll
Hi, since a month when I start debugging my app in iphone simulator and access to a specific Page the debugger detects a System.IO.FileNotFoundException related to this path:
/Users/xxx/Library/Developer/CoreSimulator/Devices/CF741BB8-6814-4895-9BEE-76E8E82C9F11/data/Containers/Bundle/Application/685D5325-455C-405C-A600-D49E4A12EC78/xxx.iOS.app/en-US/Xamarin.Forms.Platform.iOS.resources.dll
I look inside the path and i don't found a folder named /en-US/
After that I change localization to Italian and a similar FileNotFoundException raised related to path:
/Users/xxx/Library/Developer/CoreSimulator/Devices/CF741BB8-6814-4895-9BEE-76E8E82C9F11/data/Containers/Bundle/Application/685D5325-455C-405C-A600-D49E4A12EC78/xxx.iOS.app/it-IT/Xamarin.Forms.Platform.iOS.resources.dll
Inside the app bundle there is the folder /it/ not the folder /it-IT/.
I tried to check XAML and sources for wrong references, paths and names without success.
I also checked and upgraded anything.
Can someone help me on this problem?