I have a code which display a data in xamarin form as a list. It display well in debug mode but display nothing is list while in release or by APK. It release mode display display button in list which is a static only. Below is the code i have done in my form. can any once guide me to solve this.
<StackLayout>
<ListView Grid.Row="1" x:Name="listLogin" ItemsSource="{Binding callLogList}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid x:Name="Item">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="1" x:Name="ImgCallType" Source="{Binding ImageUrl}" Style="{Binding width:50px,height:50px;}"></Image>
<Label Grid.Column="2" FontSize="Subtitle" Text="{Binding Mobilenumber}"></Label>
<Label Grid.Column="3" FontSize="Subtitle" Text="12345"></Label>
<Button Grid.Column="4" Text="Add" TextColor="Black" HorizontalOptions="EndAndExpand" Clicked="" CommandParameter="{Binding Mobilenumber}"/>
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
public partial class MiscallData : ContentPage
{
public MiscallData()
{
InitializeComponent();
GetCallLogs();
}
public void GetCallLogs()
{
Android.Content.Context myContext = Android.App.Application.Context;
string OutgoingqueryFilter = string.Format("{0}={1}", CallLog.Calls.Type, (int)CallType.Outgoing);
string querySorter = string.Format("{0} desc ", CallLog.Calls.Date);
ICursor OutgoingqueryData = myContext.ContentResolver.Query(CallLog.Calls.ContentUri, null, null, null, querySorter);
List<MisscallDataModel> callLogList = new List<MisscallDataModel>();
while (OutgoingqueryData.MoveToNext())
{
MisscallDataModel model = new MisscallDataModel();
//---phone number---
model.Mobilenumber = OutgoingqueryData.GetString(OutgoingqueryData.GetColumnIndex(CallLog.Calls.Number));
//---date of call---
int secondindex = OutgoingqueryData.GetColumnIndex(CallLog.Calls.Date);
long seconds = OutgoingqueryData.GetLong(secondindex);
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yy HH:mm");
String dateString = formatter.Format(new Date(seconds));
model.Date = dateString;
model.ImageUrl = "BlockCall.png";
callLogList.Add(model);
}
listLogin.ItemsSource = callLogList;
}
}
public class MisscallDataModel
{
public long UserId { get; set; }
public string Mobilenumber { get; set; }
public string Date { get; set; }
public string callType { get; set; }
public string ImageUrl { get; set; }
}
I solved my que by my self, it is nothing wrong in code, it's just set in property setting, just go to android property and then select android option , just find Linker property there is linking , select option None, that's it.
Android project => Property => Android Options => Linker Properties => Linking => None.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.