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

Call Javascript from C# method with parameter.

$
0
0

Hi,

I have some html pages that is working fine in WebView Xamarin forms (iOS/Android).
I have one c# method that i need call from Html page javascript function.
please give me any example or any solution code.

Thanks


Any actual documentation on the profiler?

$
0
0

Yes I know there is a small write up on the website but I am talking about documentation on every single part of the application.

For example what does LIVE mean, why do some items in the class field have a blue dot on the very left and most don't... What's the difference between the startup options of Allocations and Memory... Do you really need to keep taking snapshots until Object Growth equals 0 to then start finding whats leaking... What does Size Growth represent... What does -3 represent in Object growth... When viewing a snapshot whats the little blue thing in the size column, some have it, others dont... What does Paths to roots mean and how does it help me... When i want to compare snapshots should i stop running the app or does it not matter... So I take a snapshot #1 and then five more snapshots, now what, I am supposed to find memory leaks how?

You know, some proper knowledge rather than a simple example which shows a very simple case on how to use the app...

Oh, it's enterprise only is it? Hence nobody is using it so it doesn't need proper documentation ?? wonderful.....

iOS Launch Images not showing up

$
0
0

I hate to ask a question that I know there must be an easy answer to, but for the life of me I can't get iOS to launch with the right launch images!

I have edited the iOS settings, and moved the assets to Asset Catalogues. Then opened up that Contents.json and added images for each box. No cigar. Everytime I launch, I get a blue background with my app icon centered in the middle.

Thanks in advance for any help.

Timestamp in strings

$
0
0

Dears,

I have a Label inside listview-viewcell, to show time in UI. The date is received as a number like 1510822596449 (Java timestamp). I want to show the date in strings like "n days ago". How can I achieve this?

<StackLayout>
    <ListView>
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                <StackLayout>
                    <Label Text="{Binding createdTime}"/>
                    </StackLayout>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>
</StackLayout>

I try IValueConverter in the following link, but it is not working.
https://stackoverflow.com/questions/32814176/how-to-format-date-and-time-in-xaml-in-xamarin-application

Anybody, please suggest a solution with working code. Thanks in advance.

All views inside CarouselView are null

$
0
0

I have defined a CarouselView in XAML as follows:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
    x:Class="Youni.PresentationPage">
    <controls:CarouselViewControl
        x:Name="Carousel"
        Orientation="Vertical"
        IsSwipingEnabled="false"
        VerticalOptions="FillAndExpand"
        HorizontalOptions="FillAndExpand">
        <controls:CarouselViewControl.ItemsSource>
            <x:Array
                Type="{x:Type View}">
                <ScrollView>
                    <AbsoluteLayout
                        Padding="0"
                        Margin="0">
                        <Image
                            Source="login_icon.png"
                            AbsoluteLayout.LayoutBounds=".5, .0, .3, .3"
                            AbsoluteLayout.LayoutFlags="All" />
                        <StackLayout
                            Orientation="Vertical"
                            AbsoluteLayout.LayoutBounds=".5, .5, .9, .35"
                            AbsoluteLayout.LayoutFlags="All">
                            <Label
                                Text="Unisciti a Youni!"
                                FontSize="Large"
                                FontAttributes="Bold"
                                XAlign="Center" />
                            <Entry
                                x:Name="NameEntry"
                                VerticalOptions="FillAndExpand"
                                Placeholder="Nome" />
                            <Entry
                                x:Name="SurnameEntry"
                                VerticalOptions="FillAndExpand"
                                Placeholder="Cognome" />
                            <Entry
                                x:Name="NewEmailEntry"
                                VerticalOptions="FillAndExpand"
                                Placeholder="Email"
                                Keyboard="Email" />
                            <Entry
                                x:Name="NewPasswordEntry"
                                VerticalOptions="FillAndExpand"
                                Placeholder="Password"
                                IsPassword="true" />
                        </StackLayout>
                        <Button
                            x:Name="RegisterButton"
                            Clicked="Register_Handle_Clicked"
                            AbsoluteLayout.LayoutBounds=".5, .85, .3, .07"
                            AbsoluteLayout.LayoutFlags="All"
                            Text="Registrati"
                            TextColor="White"
                            BackgroundColor="#3A8FDA" />
                        <StackLayout
                            Orientation="Horizontal"
                            HorizontalOptions="Center"
                            AbsoluteLayout.LayoutBounds=".5, 1, 1, .1"
                            AbsoluteLayout.LayoutFlags="All">
                            <StackLayout.Spacing>
                                <OnPlatform
                                    x:TypeArguments="x:Double">
                                    <On
                                        Platform="Android"
                                        Value="-10" />
                                    <On
                                        Platform="iOS"
                                        Value="3" />
                                </OnPlatform>
                            </StackLayout.Spacing>
                            <Label
                                Text="Sei già registrato?"
                                FontSize="Small"
                                YAlign="Center"
                                XAlign="Center" />
                            <Button
                                x:Name="LoginSwitchButton"
                                Pressed="LoginSwitch_Handle_Pressed"
                                Released="LoginSwitch_Handle_Released"
                                Clicked="LoginSwitch_Handle_Clicked"
                                Text="Passa al login"
                                FontSize="Small"
                                TextColor="#45BFEE"
                                BackgroundColor="Transparent" />
                        </StackLayout>
                    </AbsoluteLayout>
                </ScrollView>
                <ScrollView>
                    <AbsoluteLayout
                        Padding="0"
                        Margin="0">
                        <Image
                            Source="login_icon.png"
                            AbsoluteLayout.LayoutBounds=".5, .215, .3, .3"
                            AbsoluteLayout.LayoutFlags="All" />
                        <StackLayout
                            Orientation="Vertical"
                            AbsoluteLayout.LayoutBounds=".5, .6, .9, .14"
                            AbsoluteLayout.LayoutFlags="All">
                            <Entry
                                x:Name="EmailEntry"
                                VerticalOptions="FillAndExpand"
                                Placeholder="Email"
                                Keyboard="Email" />
                            <Entry
                                x:Name="PasswordEntry"
                                VerticalOptions="FillAndExpand"
                                Placeholder="Password"
                                IsPassword="true" />
                        </StackLayout>
                        <Button
                            x:Name="LoginButton"
                            Clicked="Login_Handle_Clicked"
                            AbsoluteLayout.LayoutBounds=".5, .85, .3, .07"
                            AbsoluteLayout.LayoutFlags="All"
                            Text="Login"
                            TextColor="White"
                            BackgroundColor="#3A8FDA" />
                        <StackLayout
                            Orientation="Horizontal"
                            HorizontalOptions="Center"
                            AbsoluteLayout.LayoutBounds=".5, 1, 1, .1"
                            AbsoluteLayout.LayoutFlags="All">
                            <StackLayout.Spacing>
                                <OnPlatform
                                    x:TypeArguments="x:Double">
                                    <On
                                        Platform="Android"
                                        Value="-10" />
                                    <On
                                        Platform="iOS"
                                        Value="3" />
                                </OnPlatform>
                            </StackLayout.Spacing>
                            <Label
                                Text="Ancora senza account?"
                                FontSize="Small"
                                YAlign="Center"
                                XAlign="Center" />
                            <Button
                                x:Name="RegistrationSwitchButton"
                                Pressed="RegistrationSwitch_Handle_Pressed"
                                Released="RegistrationSwitch_Handle_Released"
                                Clicked="RegistrationSwitch_Handle_Clicked"
                                Text="Registrati"
                                FontSize="Small"
                                TextColor="#45BFEE"
                                BackgroundColor="Transparent" />
                        </StackLayout>
                    </AbsoluteLayout>
                </ScrollView>
            </x:Array>
        </controls:CarouselViewControl.ItemsSource>
    </controls:CarouselViewControl>
</ContentPage>

In the code-behind, I can handle the buttons Clicked events, but I can't access any of the views (entries, buttons, images etc...). Always throws System.NullReferenceException. Seems like all the views are null, which does not make sense.

Stack trace:

System.NullReferenceException: Object reference not set to an instance of an object
at Youni.PresentationPage+d__5.MoveNext () [0x00034] in /Users/Max/Documents/Xamarin/Youni/Youni/Youni/PresentationPage.xaml.cs:51
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at UIKit.UIKitSynchronizationContext+c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/Foundation/NSAction.cs:163
at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at Youni.iOS.Application.Main (System.String[] args) [0x00001] in /Users/Max/Documents/Xamarin/Youni/Youni/iOS/Main.cs:17

Any Xamarin Developers from Hyderabad, India?

$
0
0

Any Xamarin Developers from Hyderabad, India?, i am looking for help.

Is it possible to restart my app?

$
0
0

I am wondering if it is possible to reset my app from within the app itself (assuming this is not "not recommended").

I am simply wanting to be able to change the language from within the app. Right now the app's language is determined by the system language, but I also want to include the option to change the language that the app uses from within the app. I've managed to do so, but when I updated the CultureInfo, any page that has already rendered still displays the old language. So I am wanting to restart the app after selecting the new language, in order to make sure it is using the correct localized strings for every page.

Otherwise, I will just have to display a message telling the user they will need to manually restart the app to see the changes.

Xamarin.iOS code sign error using iOS 11.1

$
0
0

I'm trying to build my iOS application using my new iOS build machine using iOS 11.1.

However when I build my application I get the following error:

        15>  Codesign: 2017-12-05T17:13:01.9997912+00:00 - Logging messages
        15>  Codesign Task
        15>    CodesignAllocate: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
        15>    DisableTimestamp: True
        15>    Entitlements: obj/iPhone/Debug/Entitlements.xcent
        15>    Keychain: <null>
        15>    Resources:
        15>      bin/iPhone/Debug/MyApp.iOS.app
        15>    ResourceRules: <null>
        15>    SigningKey: 1F4A95333C89923DCB777A2DC213ED088E28D9D1
        15>    ExtraArgs: <null>
        15>    IsAppExtension: False
        15>  Tool /usr/bin/codesign execution started with arguments: -v --force --sign 1F4A95333C89923DCB777A2DC213ED088E28D9D1 --entitlements /Users/me/Library/Caches/Xamarin/mtbs/builds/MyApp.iOS/8e10175d0d7b53fc009bbcaa305356f0/obj/iPhone/Debug/Entitlements.xcent --timestamp=none /Users/me/Library/Caches/Xamarin/mtbs/builds/MyApp.iOS/8e10175d0d7b53fc009bbcaa305356f0/bin/iPhone/Debug/MyApp.iOS.app
        15>  Tool /usr/bin/codesign execution finished (exit code = 1).
        15>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(1837,3): error : /Users/me/Library/Caches/Xamarin/mtbs/builds/MyApp.iOS/8e10175d0d7b53fc009bbcaa305356f0/bin/iPhone/Debug/MyApp.iOS.app: unknown error -1=ffffffffffffffff
        15>  Codesign: 2017-12-05T17:13:02.0022906+00:00 - Finished
        15>Done executing task "Codesign" -- FAILED.
        15>Done building target "_CodesignAppBundle" in project "MyApp.iOS.csproj" -- FAILED.

I have already created a new signing identity and provisioning profile and still the same error
If anyone has come across this in the past any information would be really appreciated.


Xamarin IOS verson 11.3.0.47

$
0
0

Hello,
I am working on an IOS project, which was working fine, until my xamarin.ios version got upgraded.
Now currently on version 11.3.0.47, my storyboards no longer load correctly, and when they do load functionality is not working(for example, classes are not auto generated from storyboard).
I was wondering if it was possible to roll back to an older version of Xamarin.ios, as I am in a time crunch with deadlines.

Menu populated with SQLite column

$
0
0

Alright guys, I'm sure this is an easy one I should be able to find resources for, but I haven't been able to understand what I've found (ultimate newbie here). Here's what I'm trying to accomplish:

I want to create a menu that is a list of 1 or 2 columns in a SQLite table, which you can click on to direct you to a page with the full table of details. I have the SQLite table, but I've only managed to return the entire table, not just a specific column. I want the menu to be populated from the table and not specifically enumerated in the code.

I know this should be a gimme, but I just can't seem to make it happen. What would the code for this look like?

Linear Gradient Along a Circular path?

$
0
0

Is it possible to use a series of shader [in SkiaSharp] to create a linear gradient along a circular path - as seen in this case in illustrator?
I will try to install Kimono to investigate to see if this can be done. I appreciate any link or suggestion

Master-Detail Hamburger iOS vs. Android

$
0
0

I have built a Master/Detail page with a menu. It works beautifully in Android, giving me an animated hamburger. But in iOS the hamburger becomes the word menu and only appears on one screen. Have you run into this? Is this a known and/or fixable problem?

I have followed the approach shown here.

Thanks

Could not load file or assembly Mono.Android (Not solved)

$
0
0

I need to publish my aplication to Play Store, but I couldn't build project in Release Mode to archieve it.
The exception bellow is raised:

Message:
Error Cannot register assembly "". Could not load file or assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' or one of its dependencies.

This exception occurs only in Release mode. In Debug mode, build runs correctly.

I already executed:
* Clean and Rebuild solution
* Clean and Rebuild each project separately
* Delete bin and obj folders and rebuild
* Update all packages of solution and rebuild
* Consolidate all packages and rebuild
* Referenced mono.android.dll directly from the folder "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v8.0\" and rebuild

Nothing worked for me.

There are some topics related here, however, many had no answer and those who had the answers did not help me.

The next step I'll do is install VS 2017.

My configurations:
IDE:
Visual Studio 2015 Version 14.0.25431.01 Update 3
Xamarin 4.7.10.38
Xamarin.Android 8.0.2.1

Project:
Target framework: Use Latest Platform (Android 8.0 (Oreo))
Minimum Android Version: Use compile using SDK version
Target Android version: Use compile using SDK version

Was someone lucky to solve this?

Please, I need help!

Problems after installing 15.5 on Visual Studio 2015

$
0
0

Last night I saw the announcement of the release of 15.5, so I upgraded. Everything was working ok before the upgrade, but now that I've upgraded I am getting 3 different errors:

1) In Visual Studio 2015, the Updater still shows an available update:

However if I attempt to install, I get the Change/Remove/Repair dialog:

Selecting either Change or Repair succeeds, but then the next time I Check For Updates, the same update is still shown.

2) In Visual Studio 2015, as soon as I try to build a project, I am getting an Invalid License error.

If I select ‘Use Visual Studio Professtional’, I am able to build.

I tried the steps from here
https://developer.xamarin.com/guides/cross-platform/troubleshooting/legacy-licenses/resync-licenses/
(log out, delete the license files, log back in) but it didn’t help.

3) On iOS, When I start Visual Studio for Mac and Check for Updates, I see the Visual Studio Updater 1.7:

If I select Restart and Install Update, I get a message that no updates are found:

None of these errors happened before upgrading last night.

Any ideas?

FreshMVVM vs. MVVM Light

$
0
0

Hi,

can anybody share with me their experiences with both frameworks? If someboby has used both the better.

Thanks a lot

Thomas


My Visual studio 2015 Compile for mac with 2017?

$
0
0

Hi i'm a newbie, i've on my pc windows i've install visual studio 2015 I want to say if is possibile to compile my xamarin project on ios with Visual Studio 2017 for mac? I check from visual studio site but only version of visual studio for mac is 2017. Thanks any help is apprecied

To access Microsoft sql server 2014 database using Web API(web services) using xamarin.

$
0
0

I am using Windows 10 Professional with visual studio community edition 2017 ,Microsoft sql server 2014 to access database using Web API(web services) using xamarin cross plateform app. I using tutorials of Houssem Dellai on topic "Login to asp.net identity on xamarin forms". My application projects build successfully but when I am inserting data for registration and try insert it into database table I cought System.Net.HttpExecption . Application break and no comapitble code issue.

Error inflating class android.support.design.widget.TabLayout on Jelly Bean and KitKat

$
0
0

I have the following TabLayout in my activity which works fine on Nougat, Marshmallow, and Lollipop, but throws an exception on Jelly Bean and KitKat. Any ideas? This has become beyond frustrating.

<android.support.design.widget.TabLayout p1:minWidth="25px" p1:minHeight="25px" p1:layout_width="match_parent" p1:layout_height="wrap_content" p1:id="@+id/notificationTypes" p1:theme="@style/Theme.AppCompat.Light" />

Android.Views.InflateException: Binary XML file line #1: Error inflating class android.support.design.widget.TabLayout ---> Java.Lang.Reflect.InvocationTargetException: Exception of type 'Java.Lang.Reflect.InvocationTargetException' was thrown. ---> Java.Lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.

The name 'InitializeComponent' does not exist in the current context

$
0
0

1) Updated to Visual studio 15.5
2) Created a cross-platform solution with the new .NET standard template
3) Building the .NET standard project
4) Compilation error with the error in the title

Important to mention that this issue applies both to the Windows and Mac visual studio.

a new empty project with no modifications is not passing compilation?

Console output shows different values from app display

$
0
0

I am using Syncfusion's sfSchedule and getting callback behaviour in an Android Forms app that has me completely baffled - I am getting different values in the debug log compared to what is drawn on the screen.

Their sample month cell drawing logic I customsed a little as shown below, so it would show the day/month in the cells. That works fine and the cells drawn show the expected values. However, the values dumped to the debug log are a month later. I know how stupid that sounds but I have tested it five times now, deleting from the device each time. I suspect this is a Xamarin problem but am extremely confused.

My testing process is

  • Launch the app
  • Clear the Application Output window
  • Swipe the app to move from December to January 2018
  • Observe the new, incorrect output in the Application Output window

        void Schedule_OnMonthCellLoadedEvent(object sender, MonthCellLoadedEventArgs e)
        {
            var dayStr = $"{e.date.Day}/{e.date.Month}";
            Debug.WriteLine(dayStr);  //****** writes different values to when dayStr is used below
            var monthCell = new StackLayout { BackgroundColor = Color.Transparent };
            var monthLabel = new Label();
            monthLabel.HeightRequest = 50;
            monthLabel.WidthRequest = 50;
            monthLabel.Margin = new Thickness(0, 0, 10, 10);
            monthLabel.BackgroundColor = Color.Green;
            monthLabel.Text = dayStr;  //******** shows "correct" values from dayStr
            monthLabel.TextColor = Color.White;
            monthCell.Children.Add(monthLabel);
            e.view = monthCell;
        }
    
        void Schedule_OnVisibleDatesChanged(object sender, VisibleDatesChangedEventArgs e)
        {
            var firstDay = e.visibleDates[0];
            var lastDay = e.visibleDates[e.visibleDates.Count - 1];
            Debug.WriteLine($"Dates Changed: {firstDay.Day}/{firstDay.Month} to {lastDay.Day}/{lastDay.Month}");
        }
    

AFTER A SWIPE

The device shows January 2018, as expected with a visible range drawn of 31/12 to 10/2

The debug log shows: (note - this list of strings is a month later than that displayed in the label using the same string.):

        28/1
        29/1
        ... deleted consecutive log lines to save space here
        5/3
        6/3
        7/3
        8/3
        9/3
        10/3
        Dates Changed: 31/12 to 10/2
        (note - the range in the "Dates Changed" event match the dates shown in the VISIBLE display)
Viewing all 204402 articles
Browse latest View live


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