Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

listview on iOS sometimes render an item over the top of another and in the expected location

$
0
0

Hi all,

This is something we've noticed since iOS 11 came out - sometimes the listview will render one of its items in the expected location AND also over the top of one other item.

example:

Group1

item 1

Group2

item 2

Group3

item 3 overlapped by part of item 7
item 4

Group4

item 5
item 6

Group5

item 7

Group6

item 8
(...)

Once this happens, refreshing the list, scrolling the item out of view or rotating the device to force a redraw do not clear the issue.

Has anyone here seen an issue like this?

Note: We're using xamarin forms 2.3.4.270 as newer builds have had crashing bugs related to the listview that are still unresolved.


Capture Build Commands That Are Used in Visual Studio for Mac

$
0
0

Is there a way to see/log the build commands that Visual Studio for Mac uses to build Xamarin.iOS and Xamarin.Android projects?

I'm working on some automated builds in Jenkins and I'm running into some issues when using msbuild on a Mac (builds succeed, but incorrect configuration is being used and simulator builds won't install on a simulator). I want to compare my command line arguments with whatever Visual Studio for Mac is doing (builds work as expected from Visual Studio for Mac).

Modifying children of CarouselPage inside OnCurrentPageChanged

$
0
0

Hi,

I would like to be able to modify the children of a CarouselPage when the user slides (changes the current content), but I am getting an exception: Cannot change ObservableCollection during a CollectionChanged event.

The thing is that I don't want to load all the pages in one time, since they are numerous and a bit heavy.

This is the code inside my carousel class:

protected override void OnCurrentPageChanged()
{
    base.OnCurrentPageChanged();

    Render Current = (Render)this.CurrentPage;

    this.ActualPage = Current.Page;

    if (base.Children.IndexOf(base.CurrentPage) + 1 >= this.Children.Count && base.Main.PageExists(this.ActualPage + 1))
    {
        base.Children.Add(new Render(base.Main, this.ActualPage + 1)); //exception
    }

    if (base.Children.IndexOf(base.CurrentPage) == 0 && base.Main.PageExists(this.ActualPage - 1))
    {
        base.Children.Insert(0, new Render(base.Main, this.ActualPage - 1)); //exception
    }
}

I don't see any other way than overriding this method... would be great if you have any idea. :)

Thank you

Xamarin.Forms for Mac Unit Tests

$
0
0

Working on a Xamarin Forms app targeting mac and I am trying to get Unit Tests working.

My project structure:
-Xamarin Mac App (Xamarin.Mac Full)
-Xamarin Mac Library (Xamarin.mac Full)
-Xamarin Shared App

These 3 work perfectly with NuGet references etc.

Creating a Nunit Library project I cannot reference the Xamarin Mac Library as it says it is incompatible with Xamarin Mac, 2.0

So then I tried creating a new Xamarin Mac app, was able to reference my Mac Library, but am getting an error at runtime: NUnit.Engine.NUnitEngineException: The NUnit 3.0 driver does not support the portable version of NUnit.

Anyone else hit this issue yet?

Implementing INotifyPropertyChanged in xamarin.forms

$
0
0

I am doing a cart in xamarin.forms, in my cart page there is a list view with data. Each of the cell containing a button to select the count of item and amount. In the cart view there is a label for grant total, my problem is the grant total is not updating while deleting a item from the cart . The calculation method is on item adding view cell . i know that i need to implement inotifyproperty for this, but i don't know how to do it

I have a base view model which inherit inotifyproperty which contain the event also
public class BaseViewModel : INotifyPropertyChanged{ private double _price; public double Price{ get { return _price ; } set{_price =value;OnPropertyChanged("Price");} } protected virtual void OnPropertyChanged(string propertyName){ if (PropertyChanged != null { PropertyChanged(this, new PropertyChangedEventArgs(propertyName));}}
and my view model
public BaseViewModel(){ App.Instance.ViewModel = this; TempList = TempList ?? new ObservableCollection<cm_items>(); this.Title = AppResources.AppResource.Cart_menu_title; this. Price = CartCell.price;}
my calculation method
public static double Calculate_price(){ App.Instance.ViewModel.Price = price; price = 0; var s = App.Instance.ViewModel.TempList; var itm_cnt = App.Instance.ViewModel.TempList.Count; for (int i = 0; i < itm_cnt; i++){ var val1 = s[i].cnt; var val2 = s[i].item_price; price += Convert.ToDouble(val1 * val2); } return pri

Where can we buy App Installs ?

$
0
0

buy App Installs is the best way to promote a app now a days so there are many sites for this so I am confused so please suggest me.

How to Implement Shopping Cart in Xamarin.Forms ?

$
0
0

Hi Folks,
I have to Implement shopping cart in xamarin forms app. I've never worked with Shopping cart stuff before that's why asking for suggestions here. I have a products screen where all the products are listed. Another page for Specific Product's details page that shows description, price and useful info about a specific product with "Add to Cart" button in it. Now, I want to:
1- Have a cart Icon on navigation bar that shows a number indicating how many products are there in the cart at the moment. How increment to cart icon will work ?
2- Add Multiple products in the cart (An order having multiple items).
3- Update , delete items from the cart.

I have no knowledge of how things will work in the database for shopping cart thing. Do I need to create a specific table for shopping cart? Kindly give your valuable suggestions /links on how should I implement it ?
Thanks

Generating event handler in Xaml

$
0
0

Hello, I am creating simple Button with Clicked property in Cross-Platform (xamarin forms) .Net stardard project and the is no auto event handler poping up :(
already tried clean reinstall. What could it be?


How to validate menu items?

$
0
0

I'm trying to validate menu items (i.e. enable / disable them) in my Xamarin Mac project but I cannot get my validateMenuItem method to be called:

               [Export("validateMenuItem")]
               public bool validateMenuItem(NSMenuItem menuItem)
            {
                // logic to enable / disable goes here...

                // default to true
                return true;
            }

I have placed this method in MainController.cs, MainWindow.cs and AppDelegate.cs. The menu Actions are defined in AppDelegate.h. Auto Enables Items is set to true. The Mac Developer library says "the object implementing this method (validateMenuItem) must be the target of menuItem". The menu actions all work fine. I must be doing something wrong...but what? I'd appreciate any help.

-Bill

Correct XAML pattern to bind element to BindingContext property ('x:Name' binds to page not context)

$
0
0

Hi, I'm new to Xamarin, but I've already built a few pages and have got most of the binding working flawlessly.
I am, however, having an issue figuring out the proper way to bind an element in XAML (a Map to be precise) to a child property of the BindingContext (a ViewModel). I see that the "x:Name" attribute will bind it to a property of the page class, but not the context. All the other binding examples affect values of an element, but not the element object itself.
Is there a way to do this cleanly, or do I have to do what I'm doing now where the page class passes the element (Map) along into the ViewContext manually at startup?

Gorilla Player connection timeout error

$
0
0

Hi all, I am new to using Gorilla Player in Visual studio 2017 15.5 (GA).

I have not been successful in -

  1. deploying Gorilla player to the android emulator running inside Visual Studio. Compilation and deployment of the player.droid gets hung... I kept my studio open for couple of hours and even then the deployment wasn't complete.

  2. Installed Gorilla Player on my android device (connected on the same wifi as used by my surface book and keep getting connection timeout error.

Can you please help me in getting this addressed ?

I would appreciate it.

Thanks,

Cannot update GooglePlayServices 60.1142.0

$
0
0

I am trying to update googleplay services package to 60.1142.0. It seems like that you have change with Xamarin.GooglePlayServices.Basement package and I am getting error message as below. I tried to remove Xamarin.GooglePlayServices.Basement package and tried to install other package as advised but It is still not working? what is the solution here?

Removing package 'Xamarin.GooglePlayServices.Basement.60.1142.0 : Xamarin.Android.Support.Compat [26.0.2, ), Xamarin.Android.Support.Core.UI [26.0.2, ), Xamarin.Android.Support.Core.Utils [26.0.2, ), Xamarin.Android.Support.Fragment [26.0.2, ), Xamarin.Android.Support.Media.Compat [26.0.2, ), Xamarin.Build.Download [0.4.7, )' from folder 'C:\Git\nugetpackages'
Removed package 'Xamarin.GooglePlayServices.Basement.60.1142.0 : Xamarin.Android.Support.Compat [26.0.2, ), Xamarin.Android.Support.Core.UI [26.0.2, ), Xamarin.Android.Support.Core.Utils [26.0.2, ), Xamarin.Android.Support.Fragment [26.0.2, ), Xamarin.Android.Support.Media.Compat [26.0.2, ), Xamarin.Build.Download [0.4.7, )' from folder 'C:\Git\nugetpackages'
Executing nuget actions took 3,23 min
This collection is read-only.
Time Elapsed: 00:03:30.7351044
========== Finished ==========*

Custom Fonts and the Xamarin Live Player

$
0
0

Will custom fonts be displayed in the Live Player?

How to reliably determine if a service is running?

$
0
0

Hi,

i've got a question regarding android services. For testing reasons I want a service to continously check if another service is running. So far i've found a solution here

Since I don't have a class property, I've tried typeof()/GetType()

var manager = (ActivityManager)_context.GetSystemService(Context.ActivityService); return manager.GetRunningServices(Integer.MaxValue).Any(service => typeof(TestService) == service.Service.GetType());

Which dosen't work since service.Service is of type ComponentInfo

I've also tried to work with the package name

(...).Any(service => service.Service.PackageName.Contains("net.bongolus.service_test"));

Which doesn't work too, and this isn't realy reliable.

So how do I find out if the service is running.

Sincerly
Ralph Niemeyer

Updating Xamarin broke the build process (The process cannot access the file "appName.dll.mdb")

$
0
0

I'm facing this error after updating Xamarin to the latest version today (12-2-2014) and there is no solution except closing and opening VS each time I want to run the app and this is unbearable !

Error 447 The last access/last write time on file "bin\Debug\appName.dll.mdb" cannot be set. The process cannot access the file 'C:\Users\ahmedkamal\Source\appName\bin\Debug\appName.dll.mdb' because it is being used by another process

The bug was posted to bugzilla by another developer too.

https://bugzilla.xamarin.com/show_bug.cgi?id=26841

What can be done to downgrade Xamarin at least if there is no fix for this bug ?


Java.Lang.ClassNotFoundException: while crossconnectivity.current

$
0
0

Am getting the below mentioned error while accessing Crossconnectivity properties in Xamarin Android. But it is working fine in Xamarin IOS
Java.Lang.ClassNotFoundException: while crossconnectivity.current

I had tried in Plugin.Connectivity 3.0.3 & 4.0.0.171 Pre-release versions

Xamarin Live Player iOS Question

$
0
0

I installed the Xamarin Live Player on my iPhone to develop my app for iOS, too.
Trying to run the project tells me that the type or namespace App could not be found, even thought it does, and the code compiles.
Also, trying a new blank project throws me another exception.

Have those issues been fixed in the Alpha program?

Thanks.

VS on Mac Constraints

$
0
0

VS on Mac for xamarin just got update and the IDE changed and the auto constraints button is gone.
Get replaced ,moved???

StartActivity for result calls the Second activity OnCreate once again

$
0
0

First Activity

namespace TrackView.Screens
{
[Activity(Label = "MainActivity", Theme = "@style/AppTheme.NoActionBar")]
public class MainActivity : AppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);

        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);
        Button btn = FindViewById<Button>(Resource.Id.button1);
        btn.Text = "First";
        btn.Click += Btn_Click;
    }
    private void Btn_Click(object sender, System.EventArgs e)
    {
        var intent = new Intent(this, typeof(SecondActivity));
        StartActivityForResult(intent, 2);
    }

    protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
    {
        base.OnActivityResult(requestCode, resultCode, data);
        if (requestCode == 2)
        {

            if (resultCode == Result.Ok)
            {
                string isd = data.GetStringExtra("MESSAGE");
                Toast.MakeText(this, isd.ToString(), ToastLength.Long).Show();
            }
        }
    }
}

}

Second Activity

namespace TrackView.Screens
{
[Activity( Theme = "@style/AppTheme.NoActionBar")]
public class CountryList : AppCompatActivity
{
ListView listView;
CountryListAdapter listAdapter;
List<TrackViewShared.Model.Country> cList;
private Android.Support.V7.Widget.Toolbar mToolbar;
private EditText edtSeach;
static TrackViewServiceManager trackViewServiceMgr;

    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.country_list_layout);

            mToolbar = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.toolbar_country);

            SetSupportActionBar(mToolbar);
            Android.Support.V7.App.ActionBar action = this.SupportActionBar;
            action.SetDisplayShowCustomEnabled(true);
            action.SetCustomView(Resource.Layout.search_bar_country);//add the custom view
            action.SetDisplayShowTitleEnabled(false); //hide the title

            edtSeach = (EditText)action.CustomView.FindViewById(Resource.Id.edtSearch); //the text editor

            edtSeach.TextChanged += EdtSeach_TextChanged;
            listView = FindViewById<ListView>(Resource.Id.lvCList);

            trackViewServiceMgr = new TrackViewServiceManager(new TrackViewRestService());

            listView.SetScrollContainer(true);
            listView.ItemClick += ListView_ItemClick;
        //RunOnUiThread(PopulateListView);
        PopulateListView();

       // PopulateListView();


    }

    private void EdtSeach_TextChanged(object sender, Android.Text.TextChangedEventArgs e)
    {
       List<Country> cl = cList.Where(c => c.countryName.Contains(edtSeach.Text)).ToList<Country>();
        var filterdAdatper = new CountryListAdapter(this, cl);
        listView.Adapter = filterdAdatper;
    }

    private async void PopulateListView()
    {


      cList = await trackViewServiceMgr.GetCountryList("en", "1");
      listAdapter = new CountryListAdapter(this, cList);
      listView.Adapter = listAdapter;

     }

    private void SendToJoin(string isd)
    {
        Intent intent = new Intent();
        intent.PutExtra("MESSAGE", isd);
        intent.AddFlags(ActivityFlags.ClearTop);
        SetResult(Android.App.Result.Ok, intent);
        this.Finish();//finishing activity
    }

    private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
    {
        //itemClicked = true;
        string message = ObjectTypeHelper.Cast<Country>(listView.GetItemAtPosition(e.Position)).countryId.ToString();
        //Intent intent = new Intent(this,typeof())
        //intent.PutExtra("MESSAGE", message);
        // intent.AddFlags(ActivityFlags.ClearTop );
        //
       // Intent intent = new Intent(this, typeof(JoinScreen));

        Intent intent = new Intent();
        intent.PutExtra("MESSAGE", message);
        intent.AddFlags(ActivityFlags.ClearTop);
        SetResult(Android.App.Result.Ok, intent);
        this.Finish();


    }


}

My purpose is this: while clicking on the "ISD" edit box in activity 1, a second activity containing a list of countries will be displayed from which the user will select a country and after that the first activity will get the country code. In activity second, I have used async calls to list of countries from the RESETful webservice. But here the problem is after finishing the Activity2, Activity 1 never displayed to show the ISD code ( that means, StartActivityForResult seems to be not working properly as intended.. While debugging its found that, OnCreate method of Activity2 is called again after finishing it.. 1 Day passed, but I didnt get a solution.. Please help

Using Ads Lite for Amazon Store

$
0
0

"Ads Lite has a reduced footprint because it is unlike the standard Ads SDK, which includes the Google Play services client libraries. Ads Lite strips away the implementation and leaves only an interface for us to develop against. This means that Google Play services must be installed and updated on the device that your app is running on. It’s only recommended to use the Lite SDK if distributing through the Google Play store. If a device doesn’t have Google Play services, it will log an error and an ad will not be displayed."

there is this annotation for ads lite and I am using ads lite to display ads. Now I want to publish my app into amazon store. Does it mean that I cant use Ads Lite any longer? Does Amazon devices have Google play store client?

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>