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

how to retrieve data(entry, label ) from listview and display in another page?

$
0
0

Model...
namespace CafeMgmt.Models
{
public class Item_Model
{
public string Id { get; set; }
public string Title { get; set; }
public string Price { get; set; }
public string Quantity { get; set; }

}

}

View...(XAML)

<ListView.ItemTemplate>




                    <Label x:Name="lbl_price"
                           Text="{Binding Price}"
                           Margin="10,10,10,0"
                           WidthRequest="60"
                           FontAttributes="None"
                           FontSize="14"
                           TextColor="Wheat" />

                        <Entry x:Name="qty"
                            Text="{Binding Quantity}"
                            Placeholder="qty"
                            WidthRequest="40"
                            Keyboard="Numeric"
                            TextColor="Wheat"
                            PlaceholderColor="Wheat" />

                        <Button x:Name="ok_btn" 
                            Text="ok"
                            WidthRequest="60"
                            Clicked="Ok_Clicked"/> 
                </StackLayout>
                <!--    </ViewCell.View> -->
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

</StackLayout>


Could not load assembly Xamarin.Android.Support.Fragment (Xamarin.Forms 2.5)

$
0
0

Hi,

I tried to upgrade to latest release of Xamarin.Forms v2.5.0.77107 (was before on v2.4.0.74863). It works properly for my iOS and shared projects but compilation fails for my Android project:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Fragment, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.Fragment.dll'
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00099] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:220 
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:170 
  at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <593a6fd557984367bb21e275d0fa0659>:0 
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <593a6fd557984367bb21e275d0fa0659>:0  (LionsBase.Droid)

The Package section of my project does not have any reference to Xamarin.Android.Support.Fragment and if I try to add it manually, I get exception:

Could not install package 'Xamarin.Android.Support.Fragment 26.1.0.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Tried to choose an older release (24 or so) and error is similar.

My project is targeting Android 5.0 (API level 21) up to Android 7.0 (API level 24).

Tried to raise the maximum to Android 7.1 (API level 25) but it does not help.

your binary is not optimized for iphone 5

$
0
0

I have an error when attempting to upload my ipa using the application loader. I am using visual studio 2017 on the latest xamarin build 4.5
I am using a LaunchScreen.storyboard. I also have the the iPhone 5 images in the asset catalog.
Anyone else having problems or could offer a solution?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>CFBundleIdentifier</key>
        <string>com.ExampleApp.ExampleOfApp</string>
        <key>CFBundleShortVersionString</key>
        <string>1.0</string>
        <key>CFBundleVersion</key>
        <string>1.0</string>
        <key>LSRequiresIPhoneOS</key>
        <true/>
        <key>UIDeviceFamily</key>
        <array>
            <integer>1</integer>
            <integer>2</integer>
        </array>
        <key>UIRequiredDeviceCapabilities</key>
        <array>
            <string>armv7</string>
        </array>
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UIViewControllerBasedStatusBarAppearance</key>
        <false/>
        <key>CFBundleIconFiles</key>
        <array/>
        <key>UIPrerenderedIcon</key>
        <true/>
        <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
        </dict>
        <key>UILaunchStoryboardName</key>
        <string>LaunchScreen.storyboard</string>
        <key>NSCameraUsageDescription</key>
        <string>This app needs access to the camera to take photos.</string>
        <key>NSPhotoLibraryUsageDescription</key>
        <string>This app needs access to photos.</string>
        <key>NSMicrophoneUsageDescription</key>
        <string>This app needs access to microphone.</string>
        <key>CFBundleDisplayName</key>
        <string>Example App</string>
        <key>XSAppIconAssets</key>
        <string>Resources/Media.xcassets/AppIcons.appiconset</string>
        <key>CFBundleShortVersion</key>
        <string>1</string>
        <key>UIRequiresFullScreen</key>
        <true/>
        <key>MinimumOSVersion</key>
        <string>10.3</string>
      <key>UILaunchImages</key>
      <array>
        <dict>
          <key>UILaunchImageMinimumOSVersion</key>
          <string>7.0</string>
          <key>UILaunchImageName</key>
          <string>Default-568h.png</string>
          <key>UILaunchImageOrientation</key>
          <string>Portrait</string>
          <key>UILaunchImageSize</key>
          <string>{320, 568}</string>
        </dict>
      </array>
        <key>XSLaunchImageAssets</key>
        <string>Resources/Media.xcassets/LaunchImages.launchimage</string>  
    </dict>
    </plist>

Best practices for having the same back-end database for Xamarin.Forms App and ASP.Net(Core/MVC/API)

$
0
0

Hi everyone,
I am working on a Xamarin.Forms mobile App, for which I want to use Azure Easy Tables to provide off-line sync.
Additionally, I need to have both, an ASP.NET Web App and a Web API endpoints that connect to the same database, and allow displaying/modifying the data in the database, and authenticating against it.

So summarizing, I need:
1. A way to support off-line sync for my Xamarin.Forms app
2. Have a ASP.NET MVC and Web API that authenticate against the same database.
3. The Web App and Web API must also be able to interact with the database to perform CRUD operations.

Ideally, I would have just one ASP.NET MVC backend service that would have the following controllers:
- /auth/: to authenticate, create users, etc.
- /tables/: for easy tables support and offline sync
- /api/ : for other API functions I'd like to add as part of the same service.

Questions:
1. Are there any best practices or design patterns to achieve this in the easiest and more maintenance friendly way?
2. Is it Possible/OK to publish a MVC/WebAPI service to an Azure App service that has EasyTables enabled? (meaning there would be both a Node.JS and ASPNET web app running at the same time?)
3. Bonus question: is it possible to use TableControllers in a ASP.NET Core 2.0 application?

Any points would be greatly appreciated! thanks a lot!
K.

App Crashes With "Android.Content.Res.Resources+NotFoundException: Unable to find resource ID #0x1"

$
0
0

Please help on this exception I'm getting.

I have been all over my project the whole day but cannot yet figure out why I'm getting this exception. It's basically saying that some resource is not found but it's not telling which resource exactly. It's maddening since I'm using over 100 images.

Android.Content.Res.Resources+NotFoundException: Unable to find resource ID #0x1
at android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1
at at android.content.res.Resources.getResourceName(Resources.java:2235)
at at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1059)
at at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
at at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
at at mono.java.lang.RunnableImplementor.n_run(Native Method)
at at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at at android.os.Handler.handleCallback(Handler.java:739)
at at android.os.Handler.dispatchMessage(Handler.java:95)
at at android.os.Looper.loop(Looper.java:148)
at at android.app.ActivityThread.main(ActivityThread.java:5487)
at at java.lang.reflect.Method.invoke(Native Method)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:765)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:655)

Binding libary incompatibility - HERE Maps SDK

$
0
0

Hi,

Hopefully someone can help me out here, :s

Does anyone know who is best to talk to around binding project issues, we are unable to bind to the HERE maps SDK which is becoming a major roadblock to us.

There have been some basic mentions a while back whree people said its due to the way they use proguard with there AAR librarys. But that seems odd as the other libraries I've bound have all worked fine in the past.

Below is the erros I am recieving during binding.

Archive Distribute Button not Working

$
0
0

After I made the update for Xamarin 4.9.0.749 yesterday, the button Distribute in the Archive Manager simply don't answer. It is like it is not enabled.
My project builds fine, without errors, also no error is displayed during archive process and there are no build comments.
I`m using VS 2015 Community Version 14.0.25431.01 update 3.

The only different thing I noticed, is that when I open a project, it shows a message that Components are not supported anymore, to migrate to nugets. I already deleted the components everywhere (project, folder and appData/xamarin/cache/Components) and the message still shows.

Anyone knows how to proceed?

Linker error after updating to Xamarin.Mac 7.4

$
0
0

Hello,

I just updated to Xamarin.Mac 7.4, and I am now seeing a linker error when trying to build my project:

Process exited with code 1, command:
xcrun -sdk macosx clang -g -mmacosx-version-min=10.11 -arch x86_64 -fobjc-runtime=macosx -ObjC ...
ld: framework not found MetalPerformanceShaders
clang : error : linker command failed with exit code 1 (use -v to see invocation)

I didn't add MetalPerformanceShaders (nor do I need it). I am developing on macOS 10.11.6, and (as you see) targeting minimum macOS version 10.11 as well.

Any ideas on how to fix this?


MacOS null reference crash on app start

$
0
0

I'm trying out XF for MacOS just to get an idea about how well it might work for me in the future. I'm stuck on an issue though just trying to get it to run that I don't know how to work around.

I followed the instructions I found here.

The problem I'm getting is when I call the base.FinishedLoading(notification);

public override void DidFinishLaunching(NSNotification notification)
{
Forms.Init();
LoadApplication(new App());
base.DidFinishLaunching(notification); //exception occurs here.
}

I get a generic object not set to an instance of an object exception. If I comment out that line I don't get an exception but no "Welcome To Xamarin Forms" for my generic base page comes up either. I've tried various versions of the XF from the pre-release that is mentioned into the blog up to the latest pre-release, and latest official release.

I have been able to get the sample project from the blog to work with no problem. Best I can tell is there is some step missing from the blog's instructions.

Stacktrace

at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.UpdateMainMenu () [0x00021] in <95b581f2e57b44db8131a119f4c293d9>:0
at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00047] in <95b581f2e57b44db8131a119f4c293d9>:0
at PackageHubMacOS.AppDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00013] in /Users/almajensen/Projects/DefaultCollection/_git/ONI.Azure/Package Hub/Test/MobileTester/PackageHubMacOS/AppDelegate.cs:32
at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
at AppKit.NSApplication.Main (System.String[] args) [0x00041] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.2.0.20/src/Xamarin.Mac/AppKit/NSApplication.cs:100
at PackageHubMacOS.MainClass.Main (System.String[] args) [0x00017] in /Users/almajensen/Projects/DefaultCollection/_git/ONI.Azure/Package Hub/Test/MobileTester/PackageHubMacOS/Main.cs:11

CocosSharp 1.7.1 .NETStarndard v2.0

$
0
0

Hi everone!
When adding CocosSharp.Forms to my .NETStandard project I get following warnings:

Warning Package 'CocosSharp.Forms 1.7.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

Is there a new version released or how should I tackle this issue?
Greetings

Refresh ui from a loop in the viewmodel

$
0
0

I have a loop in my viewmodel which cycles through random dice rolls. It works fine updating the dice for the final numbers, but I really want the dice images to cycle along with the rolls so that the user can see every number. The problem is, the command doesn't return to the Ui until the final number is bound.

How can I refresh the Ui and show the bound images during the loop?

Here is the appropriate section of code:

RandomTimes = new Random();
RandomDiceRoll = new Random();
iteration = RandomTimes.Next(25, 40);

        for (int j = 0; j < iteration; j++)
        {

            for (int i = 0; i < Dice.Length; i++)
                Dice[i] = RandomDiceRoll.Next(1, 6 + 1);

            if (!Die1Saved)
            {
                Die1 = Dice[0];
                DiePic1 = DiceImages[Dice[0]];

            }
            if (!Die2Saved)
            {
                Die2 = Dice[1];
                DiePic2 = DiceImages[Dice[1]];

            }
            if (!Die3Saved)
            {
                Die3 = Dice[2];
                DiePic3 = DiceImages[Dice[2]];

            }
            if (!Die4Saved)
            {
                Die4 = Dice[3];
                DiePic4 = DiceImages[Dice[3]];

            }
            if (!Die5Saved)
            {
                Die5 = Dice[4];
                DiePic5 = DiceImages[Dice[4]];

            }

//REFRESH THE UI SOMEHOW!!!!
}

Xamarin Sign and Distribute with Google Play Crash

$
0
0

Hello, when I try to sign with Google play, xamarin closes and i don't know why? It happens even with the "hello world".

Here is the report complete, please help and sorry for my english.

pastebin.com/LKruqMTM

WebView Load Bundled Image (GIF) in Xamarin.Mac

$
0
0

Can somebody show me how to load a bundled image resource into a WebKit.WebView? The image resides in the Resources folder and is set as BundleResource/Do not copy? I'm trying to LoadHtmlString(), but I can't seem to get the "<img src=..." reference correct. At least I think this is the problem I'm having.

Actually, I'm doing this to display an animated GIF because the GIF does not animate as the Image property in an NSImage object. Is the WebView the only way to do this, assuming the WebView even works? If tire's a better way, please let me know.

Thanks

Intellisense problem in Visual Studio

$
0
0

Hi there, I am runing my latest stable version of Xamarin on VisualStudio2015 update1 on windows 10, and I noticed some youtube video showed that they had intellisense in VS, which made me confused. The intellisense seems not working in my VS, and I did download an extension from vs gallary but it still did not work. Do I need to setup something?
Thanks for help

Visual Studio 15.6 - "AndroidKeyStore" not working

$
0
0

I use AndroidKeyStore in my project. But this is not working in Visual Studio 15.6. I run create archive and get error "apksigner.bat return code 2".
Xamarin Team - this is bug.


Invalid Signing Bug ? Where do I submit the bugs now ?

$
0
0

I have bug I wish to report,

After updating to todays release I can no longer run my application as it has been invalid signed, Just tried on another machine and worked before upgrading todays release, once updated I ran it again and I get the following.

Where do issue a bug to now, I think i saw that Issues to be place on Github correct ? Xamarin BugZilla ? Mono Git Hub ? Xamarin Git Hub ?

/Users/davidlilley/code/SomeProject /XXX/XXXX.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.Common.targets (_CompileEntitlements target) ->

Entitlements.plist:  warning : iCloud entitlements such as 'com.apple.developer.ubiquity-container-identifiers' require a Provisioning Profile.
Entitlements.plist:  warning : Cannot expand $(TeamIdentifierPrefix) in Entitlements.plist without a provisioning profile.

Creating New Cross-Platform Project in Visual Studio

$
0
0

Hi!

So, I just updated Visual Studio 2017 - Community to version 15.6.1. After this update, I no longer have the option to select between Native and Xamarin.Forms UI Technologies when I'm creating a new project. I can't post pictures/links yet, but the "UI Technology" GroupBox doesn't exist in the "New Cross-Platform App" window, while the Info TextArea to the right still states that I should pick one between Native or Xamarin.Forms.

Is this a bug, or there has been a change in Xamarin related to this, which I'm not aware of? If the latter is true, which one is the new standard? If, instead, the former is true, what can I do to solve it?

Thanks!

Xamarin Android and Microsoft.Extensions.Logging

$
0
0

I have created a "Blank App (Android)" project from the template in visual studio 2017 community. If I add the Microsoft.Extensions.Logging version 1.1.2 nuget package and start/debug the project on my Android 7.0 device, everything works. If I do the exact same thing but add version 2.0.0 (latest stable) version of the Microsoft.Extensions.Logging package, when I start/debug the application it immediately silently crashed the debugger.

Please help me figure out why this happening.

My assumption is that when the app loads its trying to find a missing reference but I have no way information to help me figure out which.

Google OAuth 2 - How to get refresh token using Xamarin.Auth?

$
0
0

0
down vote
favorite
I'm using Xamarin.Auth to authenticate the user and have access to the Google Calendar API. I'm able to get an access token and do whatever I need. The problem is the access_token I receive expires after one hour. I looked for examples and information about this in several posts but I'm still not able to ask for new tokens. Here is the code I'm using in my Xamarin.Droid Project:

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

    global::Xamarin.Forms.Forms.Init(this, bundle);
    LoadApplication(new App());

    #region [GoogleAuthentication]

    if (App.auth == null)
    {
        App.auth = new GoogleAuthenticator(App.WebApplicationClientID,
        new Uri("https://www.googleapis.com/plus/v1/people/me"),
        CalendarService.Scope.Calendar);
    }

    // We don't want to have to login every time, so we'll use the Xamarin.Auth AccountStore
    AccountStore store = AccountStore.Create(this);
    Account savedAccount = store.FindAccountsForService("google").FirstOrDefault();
    if (savedAccount != null)
    {
        App.auth.Account = savedAccount;
    }
    else
    {
        App.auth.Completed += (sender, args) =>
        {
            if (args.IsAuthenticated)
            {
                // Save the account for the future
                store.Save(args.Account, "google");
            }
        };

        Intent loginIntent = App.auth.GetUI(this);
        StartActivity(loginIntent);
    }

    #endregion [GoogleAuthentication]
}

The GoogleAuthenticator class implements OAuth2Authenticator as seen below:

public class GoogleAuthenticator
: OAuth2Authenticator
{
public GoogleAuthenticator(string clientId, Uri callbackUri, params string[] scopes)
: base(
clientId,
(scopes ?? Enumerable.Empty()).Aggregate(string.Empty, (o, s) => o + " " + s),
new Uri("https://accounts.google.com/o/oauth2/auth"),
callbackUri,
null)
{
Completed += (sender, args) =>
{
Account = args.Account;
};
}

public Account Account
{
    get;
    set;
}

public void ApplyAuthenticationToRequest(HttpWebRequest request)
{
    if (Account == null)
        throw new InvalidOperationException("You must be authenticated to make requests");

    string token = Account.Properties["access_token"];
    string type = Account.Properties["token_type"];
    request.Headers[HttpRequestHeader.Authorization] = String.Format("{0} {1}", type, token);
}

}

I tried changing the authorizationUrl adding the parameters approval_prompt=force and access_type=offline but it didn't work too.

How can I get the refresh_token using Xamarin.Auth?

Thanks.

In my app structure is like below, Page 1 -> Page 2 -> Page3 -> Page 4 ->Page 5 ...

$
0
0

In my app structure is like below,
Page 1 -> Page 2 -> Page3 -> Page 4 ->Page 5 -> Page 6

Now my problem is to navigate user from Page 4 -> Page 2 and Page 5-> Page 2 and Page 6 -> Page 3 like that ....

How can i properly navigate user from Page 4 -> Page 2 and Page 5-> Page 2 and Page 6 -> Page 3 like that ....

Viewing all 204402 articles
Browse latest View live


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