Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 75885 articles
Browse latest View live

FreshTinyIoC.TinyIoCResolutionException: Resolve failed: APageModel

$
0
0

Hello @MichaelRidland , I have a bug I'd like to report that's driving me nuts for the past few days.
When I try to resolve a page model, very often I get an exception, more precisely a TinyIoCResolutionException

I thought I have a bad code, or some bad IOC Registrations, but I turned everything off and I am trying the same with an empty PageModel + empty Page and still get the exception thrown.

I tried cleaning - rebuilding the project. I've also tried deleting all bin and obj folders throughout the solution, still no success.
Sometimes the PageModel is resolved without a problem, and the next minute it fails again. It's really driving me crazy.

I am using the new .Net standard type of Xamarin projects.

Here is my app.xaml.cs:

public App()
{
    InitializeComponent();
    MainPage = FreshMvvm.FreshPageModelResolver.ResolvePageModel<APageModel>();
}

Here is the empty page model (In the PageModels namespace of course):

public class APageModel : FreshMvvm.FreshBasePageModel
{
        public APageModel()
        {

        }
}

As well as the xaml page:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="FitGirlsDiary.Pages.APage">
    <ContentPage.Content>
        <StackLayout>
            <Label Text="Welcome to Xamarin.Forms!"
                VerticalOptions="CenterAndExpand" 
                HorizontalOptions="CenterAndExpand" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

Here is the long and detailed Output Window:

01-31 15:29:55.998 D/Mono    ( 7407): Found as 'java_interop_jnienv_get_static_field_id'.
01-31 15:29:56.001 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.001 D/Mono    ( 7407): Searching for 'java_interop_jnienv_get_static_int_field'.
01-31 15:29:56.001 D/Mono    ( 7407): Probing 'java_interop_jnienv_get_static_int_field'.
01-31 15:29:56.001 D/Mono    ( 7407): Found as 'java_interop_jnienv_get_static_int_field'.
01-31 15:29:56.010 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.010 D/Mono    ( 7407): Searching for 'java_interop_jnienv_call_void_method_a'.
01-31 15:29:56.010 D/Mono    ( 7407): Probing 'java_interop_jnienv_call_void_method_a'.
01-31 15:29:56.010 D/Mono    ( 7407): Found as 'java_interop_jnienv_call_void_method_a'.
01-31 15:29:56.018 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Platform.Android[0xb2f3c6c0] -> System[0xb2f3daa0]: 3
01-31 15:29:56.018 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Core[0xb2f3c600] -> System.Core[0xb2f3d3e0]: 5
01-31 15:29:56.037 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.037 D/Mono    ( 7407): Searching for 'java_interop_jnienv_call_boolean_method_a'.
01-31 15:29:56.037 D/Mono    ( 7407): Probing 'java_interop_jnienv_call_boolean_method_a'.
01-31 15:29:56.037 D/Mono    ( 7407): Found as 'java_interop_jnienv_call_boolean_method_a'.
01-31 15:29:56.042 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.042 D/Mono    ( 7407): Searching for 'java_interop_jnienv_get_field_id'.
01-31 15:29:56.042 D/Mono    ( 7407): Probing 'java_interop_jnienv_get_field_id'.
01-31 15:29:56.042 D/Mono    ( 7407): Found as 'java_interop_jnienv_get_field_id'.
01-31 15:29:56.045 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.045 D/Mono    ( 7407): Searching for 'java_interop_jnienv_get_int_field'.
01-31 15:29:56.045 D/Mono    ( 7407): Probing 'java_interop_jnienv_get_int_field'.
01-31 15:29:56.045 D/Mono    ( 7407): Found as 'java_interop_jnienv_get_int_field'.
01-31 15:29:56.079 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.079 D/Mono    ( 7407): Searching for 'java_interop_jnienv_get_float_field'.
01-31 15:29:56.079 D/Mono    ( 7407): Probing 'java_interop_jnienv_get_float_field'.
01-31 15:29:56.079 D/Mono    ( 7407): Found as 'java_interop_jnienv_get_float_field'.
01-31 15:29:56.104 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.104 D/Mono    ( 7407): Searching for 'java_interop_jnienv_new_int_array'.
01-31 15:29:56.104 D/Mono    ( 7407): Probing 'java_interop_jnienv_new_int_array'.
01-31 15:29:56.104 D/Mono    ( 7407): Found as 'java_interop_jnienv_new_int_array'.
01-31 15:29:56.106 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.106 D/Mono    ( 7407): Searching for 'java_interop_jnienv_set_int_array_region'.
01-31 15:29:56.106 D/Mono    ( 7407): Probing 'java_interop_jnienv_set_int_array_region'.
01-31 15:29:56.106 D/Mono    ( 7407): Found as 'java_interop_jnienv_set_int_array_region'.
01-31 15:29:56.109 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.109 D/Mono    ( 7407): Searching for 'java_interop_jnienv_get_int_array_region'.
01-31 15:29:56.109 D/Mono    ( 7407): Probing 'java_interop_jnienv_get_int_array_region'.
01-31 15:29:56.109 D/Mono    ( 7407): Found as 'java_interop_jnienv_get_int_array_region'.
01-31 15:29:56.151 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Platform.Android[0xb2f3c6c0] -> FormsViewGroup[0xb40ad280]: 2
01-31 15:29:56.169 D/Mono    ( 7407): Assembly Ref addref FitGirlsDiary[0xb40ad100] -> mscorlib[0xb40ad0a0]: 36
01-31 15:29:56.169 D/Mono    ( 7407): The request to load the retargetable assembly mscorlib v2.0.5.0 was remapped to mscorlib v2.0.5.0
01-31 15:29:56.169 D/Mono    ( 7407): Assembly Ref addref FreshIOC[0xb40ad580] -> mscorlib[0xb40ad0a0]: 37
01-31 15:29:56.169 D/Mono    ( 7407): Remapped public key token of retargetable assembly System.Core from 7cec85d7bea7798e to b77a5c561934e089
01-31 15:29:56.169 D/Mono    ( 7407): The request to load the retargetable assembly System.Core v2.0.5.0 was remapped to System.Core v2.0.5.0
01-31 15:29:56.170 D/Mono    ( 7407): Unloading image System.Core.dll [0x9ca4e000].
01-31 15:29:56.170 D/Mono    ( 7407): Image addref System.Core[0x9cd28a20] -> System.Core.dll[0x9cfb7000]: 5
01-31 15:29:56.170 D/Mono    ( 7407): Config attempting to parse: 'System.Core.dll.config'.
01-31 15:29:56.171 D/Mono    ( 7407): Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Core/System.Core.config'.
01-31 15:29:56.171 D/Mono    ( 7407): Assembly Ref addref FreshIOC[0xb40ad580] -> System.Core[0xb2f3d3e0]: 6
01-31 15:29:56.171 D/Mono    ( 7407): Assembly Ref addref FreshMvvm[0xb40ad460] -> mscorlib[0xb40ad0a0]: 38
01-31 15:29:56.172 D/Mono    ( 7407): Assembly Ref addref Realm.DataBinding[0xb40ad700] -> mscorlib[0xb40ad0a0]: 39
01-31 15:29:56.172 D/Mono    ( 7407): Assembly Ref addref Realm[0xb40ad820] -> mscorlib[0xb40ad0a0]: 40
01-31 15:29:56.173 D/Mono    ( 7407): Assembly Ref addref Realm.Sync[0xb40ad760] -> mscorlib[0xb40ad0a0]: 41
01-31 15:29:56.173 D/Mono    ( 7407): Assembly Ref addref Realm.Sync[0xb40ad760] -> Realm[0xb40ad820]: 2
01-31 15:29:56.173 D/Mono    ( 7407): Assembly Ref addref Remotion.Linq[0xb40adac0] -> mscorlib[0xb40ad0a0]: 42
01-31 15:29:56.174 D/Mono    ( 7407): Assembly Ref addref System.Runtime.CompilerServices.Unsafe[0xb40adb20] -> mscorlib[0xb40ad0a0]: 43
01-31 15:29:56.176 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Platform[0xb2f3c780] -> mscorlib[0xb40ad0a0]: 44
01-31 15:29:56.176 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> mscorlib[0xb40ad0a0]: 45
01-31 15:29:56.176 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> Xamarin.Forms.Core[0xb2f3c600]: 5
01-31 15:29:56.176 D/Mono    ( 7407): Assembly Ref addref FitGirls.TransferLayer[0xb2f3c900] -> mscorlib[0xb40ad0a0]: 46
01-31 15:29:56.176 D/Mono    ( 7407): Assembly Ref addref FitGirls.Data[0xb2f3c9c0] -> mscorlib[0xb40ad0a0]: 47
01-31 15:29:56.177 D/Mono    ( 7407): Assembly Ref addref System.Linq[0xb2f3d2c0] -> mscorlib[0xb40ad0a0]: 48
01-31 15:29:56.179 D/Mono    ( 7407): Assembly Ref addref System.Xml[0xb2f3ee80] -> mscorlib[0xb40ad0a0]: 49
01-31 15:29:56.193 D/Mono    ( 7407): Assembly Ref addref FitGirlsDiary[0xb40ad100] -> FreshMvvm[0xb40ad460]: 2
01-31 15:29:56.193 D/Mono    ( 7407): Assembly Ref addref FreshMvvm[0xb40ad460] -> System[0xb2f3daa0]: 4
01-31 15:29:56.193 D/Mono    ( 7407): Assembly Ref addref FreshMvvm[0xb40ad460] -> Xamarin.Forms.Core[0xb2f3c600]: 6
Resolved pending breakpoint at 'App.xaml.cs:30,1' to void FitGirlsDiary.App..ctor () [0x0000f].
01-31 15:29:56.221 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Core[0xb2f3c600] -> Xamarin.Forms.Platform[0xb2f3c780]: 2
01-31 15:29:56.286 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:29:56.286 D/Mono    ( 7407): Searching for 'java_interop_jnienv_call_int_method_a'.
01-31 15:29:56.286 D/Mono    ( 7407): Probing 'java_interop_jnienv_call_int_method_a'.
01-31 15:29:56.286 D/Mono    ( 7407): Found as 'java_interop_jnienv_call_int_method_a'.
01-31 15:29:56.298 D/Mono    ( 7407): Assembly Ref addref FitGirlsDiary[0xb40ad100] -> Xamarin.Forms.Xaml[0xb2f3c840]: 2
01-31 15:29:56.300 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> System.Xml[0xb2f3ee80]: 3
01-31 15:29:56.309 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> System[0xb2f3daa0]: 5
01-31 15:29:56.498 D/Mono    ( 7407): Assembly Ref addref System.Xml[0xb2f3ee80] -> System[0xb2f3daa0]: 6
01-31 15:29:56.684 D/Mono    ( 7407): Assembly Ref addref Xamarin.Forms.Xaml[0xb2f3c840] -> System.Core[0xb2f3d3e0]: 7
01-31 15:29:59.979 D/Mono    ( 7407): Assembly Ref addref FreshMvvm[0xb40ad460] -> FreshIOC[0xb40ad580]: 2
Unhandled Exception:

FreshTinyIoC.TinyIoCResolutionException: Resolve failed: APageModel

Here is the output window after I try clicking on Continue. I believe it may have some valueable info...

01-31 15:35:06.612 D/Mono    ( 7407): DllImport attempting to load: '/system/lib/liblog.so'.
01-31 15:35:06.612 D/Mono    ( 7407): DllImport loaded library '/system/lib/liblog.so'.
01-31 15:35:06.612 D/Mono    ( 7407): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
01-31 15:35:06.612 D/Mono    ( 7407): Searching for '__android_log_print'.
01-31 15:35:06.612 D/Mono    ( 7407): Probing '__android_log_print'.
01-31 15:35:06.612 D/Mono    ( 7407): Found as '__android_log_print'.
01-31 15:35:06.618 I/MonoDroid( 7407): UNHANDLED EXCEPTION:
01-31 15:35:06.660 I/MonoDroid( 7407): FreshTinyIoC.TinyIoCResolutionException: Resolve failed: APageModel
01-31 15:35:06.660 I/MonoDroid( 7407):   at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x0005f] in <88d288788c3d4f6eac793c4b6e65bc37>:0 
01-31 15:35:06.660 I/MonoDroid( 7407):   at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x00000] in <88d288788c3d4f6eac793c4b6e65bc37>:0 
01-31 15:35:06.660 I/MonoDroid( 7407):   at FreshTinyIoC.FreshTinyIoCContainer.ResolveInternal (FreshTinyIoC.FreshTinyIoCContainer+TypeRegistration registration, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x001ba] in <88d288788c3d4f6eac793c4b6e65bc37>:0 
01-31 15:35:06.660 I/MonoDroid( 7407):   at FreshTinyIoC.FreshTinyIoCContainer.Resolve (System.Type resolveType) [0x00011] in <88d288788c3d4f6eac793c4b6e65bc37>:0
01-31 15:35:06.660 I/MonoDroid( 7407):   at FreshTinyIoC.FreshTinyIoCContainer.Resolve[ResolveType] () [0x00000] in <88d288788c3d4f6eac793c4b6e65bc37>:0 
01-31 15:35:06.660 I/MonoDroid( 7407):   at FreshMvvm.FreshTinyIOCBuiltIn.Resolve[ResolveType] () [0x00000] in /Users/michaelridland/Projects/FreshMvvm/src/FreshMvvm/FreshTinyIOCBuiltIn.cs:36 
01-31 15:35:06.660 I/MonoDroid( 7407):   at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] (System.Object initData) [0x00000] in /Users/michaelridland/Projects/FreshMvvm/src/FreshMvvm/FreshPageModelResolver.cs:17 
01-31 15:35:06.660 I/MonoDroid( 7407):   at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] () [0x00000] in /Users/michaelridland/Projects/FreshMvvm/src/FreshMvvm/FreshPageModelResolver.cs:12 
01-31 15:35:06.660 I/MonoDroid( 7407):   at FitGirlsDiary.App..ctor () [0x0000f] in D:\Development\VisualStudio\Projects\FitGirlsDiary_Repo\FitGirlsDiary\FitGirlsDiary\App.xaml.cs:30 
01-31 15:35:06.660 I/MonoDroid( 7407):   at FitGirlsDiary.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00027] in D:\Development\VisualStudio\Projects\FitGirlsDiary_Repo\FitGirlsDiary\FitGirlsDiary.Android\MainActivity.cs:23 
01-31 15:35:06.660 I/MonoDroid( 7407):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <28e323a707a2414f8b493f6d4bb27c8d>:0 
01-31 15:35:06.660 I/MonoDroid( 7407):   at (wrapper dynamic-method) System.Object:66a74b74-0063-4811-8a6f-05873ff0d85c (intptr,intptr,intptr)
01-31 15:35:06.678 W/art     ( 7407): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
01-31 15:35:06.682 D/Mono    ( 7407): DllImport searching in: '__Internal' ('(null)').
01-31 15:35:06.682 D/Mono    ( 7407): Searching for 'java_interop_jnienv_throw'.
01-31 15:35:06.682 D/Mono    ( 7407): Probing 'java_interop_jnienv_throw'.
01-31 15:35:06.682 D/Mono    ( 7407): Found as 'java_interop_jnienv_throw'.
An unhandled exception occured.

For reference, here is a snapshot that all my FreshMvvm versions are the same:


Slider circular bar

$
0
0

Hi,
How to achieve Slider circular bar
in xamarin forms.

Binding to xamarin.forms ListView

$
0
0

Using xamarin.forms .Net Library to dev an app with MusixMatch api. I've created the necessary class and the Http request works, but it's not passing the response class properties to my ListView in xaml. Any help will be appreciated. Thanks. Below is my code.

TrackListResponse.cs
public class TrackListResponse
{
public Message message { get; set; }

        public class Header
        {
            public int status_code { get; set; }
            public double execute_time { get; set; }
            public int available { get; set; }
        }

        public class PrimaryGenres
        {
            public List<object> music_genre_list { get; set; }
        }
    public class SecondaryGenres
    {
        public List<object> music_genre_list { get; set; }
    }

    public class Track
    {
        public int track_id { get; set; }
        public string track_mbid { get; set; }
        public string track_isrc { get; set; }
        public string track_spotify_id { get; set; }
        public string track_soundcloud_id { get; set; }
        public string track_xboxmusic_id { get; set; }
        public string track_name { get; set; }
        public List<object> track_name_translation_list { get; set; }
        public int track_rating { get; set; }
        public int track_length { get; set; }
        public int commontrack_id { get; set; }
        public int instrumental { get; set; }
        public int @explicit { get; set; }
        public int has_lyrics { get; set; }
        public int has_lyrics_crowd { get; set; }
        public int has_subtitles { get; set; }
        public int has_richsync { get; set; }
        public int num_favourite { get; set; }
        public int lyrics_id { get; set; }
        public int subtitle_id { get; set; }
        public int album_id { get; set; }
        public string album_name { get; set; }
        public int artist_id { get; set; }
        public string artist_mbid { get; set; }
        public string artist_name { get; set; }
        public string album_coverart_100x100 { get; set; }
        public string album_coverart_350x350 { get; set; }
        public string album_coverart_500x500 { get; set; }
        public string album_coverart_800x800 { get; set; }
        public string track_share_url { get; set; }
        public string track_edit_url { get; set; }
        public string commontrack_vanity_id { get; set; }
        public int restricted { get; set; }
        public DateTime first_release_date { get; set; }
        public DateTime updated_time { get; set; }
        public PrimaryGenres primary_genres { get; set; }
        public SecondaryGenres secondary_genres { get; set; }
    }

    public class TrackList
    {
        public Track track { get; set; }
    }

    public class Body
    {
        public IList<TrackList> track_list { get; set; }
    }

    public class Message
    {
        public Header header { get; set; }
        public Body body { get; set; }
    }
}

Http Request which is being passed to xaml ListView(TrackList)
public async void SearchBtn(object sender, EventArgs e)
{
string search = SearchField.Text;
try
{
var content = "";
HttpClient client = new HttpClient();

                var RestUrl = "http://api.musixmatch.com/ws/1.1/track.search?q_track=" + search + "&page_size=3&page=1&s_track_rating=desc";
                client.BaseAddress = new Uri(RestUrl);

                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

                HttpResponseMessage response = await client.GetAsync(RestUrl);
                content = await response.Content.ReadAsStringAsync();

                var items = JsonConvert.DeserializeObject<TrackListResponse>(content);

                TrackList.ItemsSource = items.message.body.track_list;

            }
            catch (Exception ex)
            {
                string exception = ex.Message;
            }
        }

Xaml

<ListView.ItemTemplate>


                                <StackLayout Orientation="Horizontal"  HorizontalOptions="FillAndExpand">
                                    <StackLayout Orientation="Vertical"  HorizontalOptions="FillAndExpand">
                                        <Label Text="Artist Name:" TextColor="Black"/>
                                    <Label Text="Song Title:" TextColor="Black"/>

                                    </StackLayout>
                                    <StackLayout Orientation="Vertical"  HorizontalOptions="EndAndExpand">
                                    <Label Text="{Binding artist_name}" TextColor="Black"/>
                                    <Label Text="{Binding track_name}" TextColor="Black"/>

                                    </StackLayout>
                                </StackLayout>

                        </StackLayout>

                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

Is there support for SearchBar on nougat 7.0?

$
0
0

Uploaded a build to test cloud which passed on multiple devices and android versions. However the 7.0 device failed because the screen didn't render my search bar.

    <ContentPage.Content>
        <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
            <StackLayout.Padding>
                <Thickness>
                    4, 0, 4, 0
                </Thickness>
            </StackLayout.Padding>

            <SearchBar x:Name="txtSearch">
            </SearchBar>

            <ListView x:Name="listCountries">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ImageCell Text="{Binding description}" TextColor="Black" ImageSource="{Binding flag, Converter={StaticResource base64ToImageSource}}" />
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ContentPage.Content>

SearchBar simply did not appear on the screen of the 7.0 device (specifically, LG Nexus 5X running Android 7.0). Is this an issue with the OS or with XF?

I've attached some images - one is a working example on a 6.0.1 device, the other shows the missing searchbar on 7.0.

Thanks,

JWF

Xamarin Blank Screen

$
0
0

I am trying to explore Xamarin, trying to create simple CURD project.

I was able to make some progress by watching youtube video's, but I am not sure what went wrong all of the sudden I am getting blank screen in my emulator when I am trying to deploy the project.

Firstly it showed me error stating

'the targetFrameWorkVersion is greater than my project version. You
need to increase the version for the project'.

I tried it, I increased my project version. This issue got resolved but gave birth new error.

Secondly

'To deploy this application, your deployment target should be running
Windows Universal Runtime version 10.0.16299.0 or higher. You
currently are running version 10.0.14393.2007. Please update your OS,
or change your deployment target to a device with the appropriate
version.'

I looked up for newer version of OS, but it seems my OS is already up to date.

I really appreciate if anyone help me out with tips or clue.

Environment is as follows

  • Visual Studio: 2017
  • Operating System: Windows 10

Cannot find Toolbar

$
0
0

Hello everybody!

In MainActivity i trying to get a Android.Support.V7.Widget.Toolbar, but he does not find. After the line of code below
ToolBar = FindViewById(Resource.Id.toolbar); ToolBar is null.
MainActivity

using Acr.UserDialogs;
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Support.V7.Widget;
using Android.Views;
using MDOSchedule.Droid.Extensions;
using Xamarin.Forms;


namespace MDOSchedule.Droid.Activities
{
    [Activity(Label = "MDOSchedule", 
              Icon = "@drawable/icon", 
              Theme = "@style/MainTheme",
              MainLauncher = true,
              ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        public static Toolbar ToolBar { get; private set; }

        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;
            ToolBar = FindViewById<Toolbar>(Resource.Id.toolbar);

            base.OnCreate(bundle);

            UserDialogs.Init(() => (Activity)Forms.Context);

            Forms.Init(this, bundle);            

            RegisterServices();

            LoadApplication(new App());
        }


        #region Private Methods

        private void RegisterServices()
        {
            DependencyService.Register<OpenAppAndroid>();
        }

        #endregion
    }
}

ToolBar Resource

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

Custom Control for iOS - Hour and minute selector.

$
0
0

Hello,
I am working on an app that requires the user to select the time for how long something took. Specifically the hours and minutes. I saw that in iOS the UIDatePicker has a mode called "countDownTimer". However creating a custom renderer for time picker and setting the mode property will cause a argument exception when the user sets the minutes. It thinks the Time property is incorrect.

Is there a simple way to do this or not really? I believe it would be possible to create a custom entry where the InputView is set to a UIDatePicker but i am unsure how to ensure values make it correctly between the picker, binding, and entry field (while converters are still being applied).

Here is some of the code I have tried.

[assembly: ExportRenderer(typeof(HourMinutePicker), typeof(HourMinutePickerRenderer))]
namespace XamarinFormsPlayground.iOS
{
    public class HourMinutePickerRenderer : TimePickerRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                var picker = Control.InputView as UIDatePicker;

                if (picker != null)
                {
                    picker.Mode = UIDatePickerMode.CountDownTimer;

                }
            }
        }
    }
}

Thanks,
Timko

Visual Studio Emulator for Android asking for HAXM instead of Hyper-V?

$
0
0

I am learning cross platform mobile app development for the first time and a few days ago had been struggling to get Visual Studio 2017 to deploy properly to ADV emulator. It was way too slow, unresponsive, and stall Visual Studio into a busy/wait state that require abrupt termination of the devenv.exe process even after closing the emulator.

That was the short summarised story; the long story with all the details and errors was submitted in another post (24 Oct) which for some reason got stuck in some moderation vacuum and hasn't appeared in this forum again.

ADD NOTE: It seems editing posts for typing mistakes sends them to some hidden place. So I've had to re-post this question.

Anyway, I understood a large contributor to the slow performance is the lack of Intel HAXM to accelerate the emulated device. Since I have Hyper-V running (on this Surface Pro 4) and that appears to be mutually incompatible with HAXM. Also I believe even with HAXM available it would only boost Intel Atom x86 virtual devices? ARM-based devices would still run punctured, and my target device was ARM.

But eventually I got around to learn that Visual Studio has its own emulator for Android separate from the default Android SDK emulator, which utilises Hyper-V. I looked at the installer options and sure enough it was there, so I checked it in. On re-launching VS2017 I saw that it added four more new target VisualStudio-based Android devices for my Xamarin.Android project. I tested a deploy to one of those devices and then a similar warning popped up

VisualStudio_android-23_x86_phone will run unaccelerated

This emulator does not have hardware acceleration enabled, and its performance will be impacted. We recommend to either:

  • Enable hardware acceleration on this machine by installing Intel© HAXM and disabling Hyper-V (requires a system restart).

I am confused what's happening here; isn't the Visual Studio Emulator for Android supposed to use Hyper-V?

Also when I check out the new Tools > Visual Studio Emulator for Android... option I can only see device profiles up to API level 23. No option for level 24/25?


What difference between ZXing.Net.Mobile.Forms and ZXing.Net.Mobile for QR code?

$
0
0

QR code scan function is needed to add into my Xamarin.Forms app. ZXing.Net.Mobile seems the most popular component. But ZXing.Net.Mobile.Forms is also available. What's the differences between ZXing.Net.Mobile.Forms and ZXing.Net.Mobile? Which one is more easy to be used? Thanks for your help

The referenced component Xamarin.iOS could not be found

$
0
0

hello

just opened some older project on a new installed visual studio 2017.
Now im getting this error:

The referenced component 'Xamarin.iOS' could not be found

In the folder C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework im missing all 'Xamarin. ...' folders.
On my old pc it works with vs 2017.

Is there a way to install the framework manually?

Simple PopupMenu Plugin for UWP/WinRT/Android/iOS

$
0
0

Hey all,
As a few of you sent me emails regarding this, I added some basic documentation for my popupmenu plugin.

Essentially, you pass it a view and an itemssource, and it will display a flyover next to the view. Its not very verbose and feature rich, but its not supposed to be! For anyone who wants a lot more, 100% check out rotorgames implemention: Rg.Plugins.Popup.

Feel free to give it a play, its pretty simple to implement and allows you a tad more flexibility over the forms actionsheets!

https://github.com/SKLn-Rad/Xam.Plugin.PopupMenu

~ Ry

Why in Xam.Forms UWP, OnAppearing and OnDisappearing are called when navigating to a content page?

$
0
0

Hey guys,

So I have an existing Xamarin.Forms app (android and iOS), and I'm recently starting to work on the UWP (which was included when I created the project, is just that I never worked on it), and for some reason the buttons on my MainPage weren't triggering my Clicked events.

Turns out that when I navigate to the MainPage, I noticed that the OnAppearing() method (where I declare all my event handlers) is invoked as expected, but then OnDisappearing() method is called immediately after, de-registering the event handlers from my controls.

Has this happened to someone else out there? Thanks.

Is there a way to disable the predictive keyboard toolbar for a Forms Entry field?

$
0
0

There appears to be a way to do this directly in iOS by manipulating the UITextAutocorrectionType field. But can it be done in a platform-agnostic way in the Forms Entry field?

Dynamically change status bar text color on Xamarin Forms iOS

$
0
0

Hi guys!

I'm having some trouble changing the status bar text color dynamically in my app. I know that there is an info.plist property to modify it for the whole application but I wanted to change it dynamically. For instance click a button and change from dark to light.

Is it possible?

can't get notification in android when app is in sleep mode

$
0
0

hello,i am trying to add onesignal pushnotification sdk in my app ,but when i am try to test app then i get notification in ios perfectly but in android when app is going to sleep mode at first time it does not get notification but when it reresume it works perfectly.
it does in all version of android.


Package restore failed.Rolling back package change for 'MapDemo.UWP'

$
0
0

Hello,
I add Google play Services package but not Install in My Project. So I add Google play Services Package but not Install and Display Error -package restore Failed.Rolling Back package change for 'MapDemo.UWP'.

how to get Id of entry in code behind?

$
0
0

Hi I want to get Id of entry(textbox) in code begind. How can I do it?

Thanks

How to implement speech(voice)-to-text using xamarin.Forms

$
0
0

Hello Guys. please help, how do i implement a speech(voice) and textbox gets the text in my application.

Weird error when I compile : IBTool exited with code 255

$
0
0

Hi,

using Visual studio comunity version 7.4.1, on Macos high sierra 10.13.3
I got on github a sample of RSS reader : https: // github.com/Mahabali/XamarinRSSFeed

when I compile, at first : I can run it.

the IOS project target IOS 10.0
the droid project target latest android 8.1

then, all package needed to be updated.
si I updated all package,
and now, I have 2 errors, which (for me) are not telling me what is wrong :
IBTool exited with code 255
the "IBTool" task failed unexpectedly

I tried to delete all bin and obj, and I tried to clean ll before build, without success.

what can I do ?
except delete visual studio, nuget packages, and reinstall everything ? (this is not an option for me :o)

thanks
Olivier

SIGABRT while debugging async methods

$
0
0

These methods used to work fine, but iOS rejected our latest App version because an unspecified error.

While debugging, they work fine, unless you go step by step after a breakpoint. After said methods finish, we get this exception:

´=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================´

We cannot progress and send the app to the store unless this gets corrected.

A brief example of one of our async methods:

async Task chargeLists () {
//Hide main screen
scroll.IsVisible = false;
//Show hidden screen with an ActivityIndicator and a "Loading" text
overlay.IsVisible = true;
await Task.Run (() => {
//Do something while thinking
});
//Hide creen with an ActivityIndicator
overlay.IsVisible = false;
//Show main screen
scroll.IsVisible = true;
}

This method is used in the first screen and is called by:

protected override async void OnAppearing () {
try {
await chargeLists ();
base.OnAppearing ();
} catch (Exception ex) {
Debug.WriteLine (string.Format ("Error: {0}", ex.Message));
}
}

protected override async void OnDisappearing () {
try {
await chargeLists ();
base.OnDisappearing ();
} catch (Exception ex) {
Debug.WriteLine (string.Format ("Error: {0}", ex.Message));
}
}

Please and thank you for your help.

Viewing all 75885 articles
Browse latest View live