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

Images in ListView - best practices?

$
0
0

Hello.

I have a few question about the best approach for handling images in ListView cells

1) If I have a background image that is shared in more than one cell, should I create it outside the cell and pass a reference for the image to the ViewCell? - I use an absolute layout inside the individual view cells, so the image location will be the same within each cell... which leads me to the next question
2) what if the image position is not the same in each cell?

Let's say in list I have a pictures of people and given condition that can change over time, I want to decorate some people with a different image or change the background
3) What is the best/recommended way to change an Image in a cell?

Thanks,

Erez


Push Notification with badge

$
0
0

I did a test this way in MainActivity

Badge badge = new Badge(this);
Contador++;
badge.count(Contador);

That test is working but is a test. Now i need to increment the badge when the App receive message(PN). This example is in the MainActivity, but all class for receive message in my App are in PCL project(App.xaml.cs). How can i do to increment the badge. And when i launch my App the badge will be reset, if i do Contador = 0 the badge is reset.

Xamarin Forms iOS app crashes with FileNotFoundException; Android app works fine.

$
0
0

I have a Xamarin Forms app which runs perfectly fine under Android on both the emulator or my physical device. However, when I try and run the iOS project, it fails on startup when its setting up the SQLLite connection/configuration.
Its throwing a FileNotFoundException complaining about System.ComponentModel.DataAnnotations.

This is referenced in the portable class project (and set Copy Local to true) and the model class that has the Data annotations works fine on Android. Indeed, if i look in

<my app path>\<myapp>.iOS\bin\iPhoneSimulator\Debug

I can see System.ComponentModel.DataAnnotations.dll in there. But for some reason the app is crashing:

        Unhandled Exception:
        System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
          at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesDataInternal (System.Reflection.ICustomAttributeProvider)
          at System.MonoCustomAttrs.GetCustomAttributesData (System.Reflection.ICustomAttributeProvider obj) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:303
          at System.Reflection.CustomAttributeData.GetCustomAttributes (System.Reflection.MemberInfo target) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System.Reflection/CustomAttributeData.cs:119
          at System.Reflection.MonoProperty.GetCustomAttributesData () [0
        x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System.Reflection/MonoProperty.cs:463
          at System.Reflection.MemberInfo.get_CustomAttributes () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/referencesource/mscorlib/system/reflection/memberinfo.cs:51
          at SQLite.TableMapping..ctor (System.Type type, SQLite.CreateFlags createFlags) [0x00100] in <9b4aaa86123841b8bec74a2ddde70f09>:0
          at SQLite.SQLiteConnection.GetMapping (System.Type type, SQLite.CreateFlags createFlags) [0x00028] in <9b4aaa86123841b8bec74a2ddde70f09>:0
          at SQLite.SQLiteConnection.CreateTable (System.Type ty, SQLite.CreateFlags createFlags) [0x00028] in <9b4aaa86123841b8bec74a2ddde70f09>:0
          at SQLite.SQLiteAsyncConnection+<>c__DisplayClass11_0.<CreateTablesAsync>b__0 () [0x0002b] in <9b4aaa86123841b8bec74a2ddde70f09>:0
          at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Version

Has anyone seen this behaviour before or have any idea how I can diagnose it?

Thanks

Integrate Facebook login in Xamarin.Forms PCl

$
0
0

I want to Integrate Facebook login in my Project that is using Xamarin.Forms PCl.

is it possible to integrate Facbook login in xamarin.form for Windows 8 App and others platform too?

Google Places Api in Xamarin.Forms Application

$
0
0

I start whit a cross-platform project where i need to use Google Places Api and other but unfortunately i don't find a library for use in Xamarin.Forms. By the way i can use web service api for get json and create my objects, now i think to create a very small library for Xamarin.Forms and i have few questions:

  • I can create objects based on json and web service api of Google Places but i don't know if this is a good idea, now i use **json2csharp **for map the json and create class but if google change a name of variable or add other my creation object failed. This is a good practice?
  • In terms of performance is good to use web service for create objects and use in xamarin.forms project?
  • This is a good idea for create a library which does not exist? I don't know the structure of this type of library

Drawer Layout Exist both in Xamarin.Android.Support.Core.UI and Xamarin.Android.Support.V4

$
0
0

I am a newbie in Xamarin with Visual Studio 2015. I have created project with Android Support V4 and V7 earlier, and it's work fine. But after i add components from Google Play Service MAP, then all my V4 objects get errors. For instance my drawer layout, this is the error :

Severity Code Description Project File Line Suppression State Error CS0433 The type 'DrawerLayout' exists in both 'Xamarin.Android.Support.Core.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' gtSMobileAndroid D:\Source_eMedWeb\gotoSehat\gtSMobileAndroid\gtSMobileAndroid\MainActivity.cs 20 Active

I have done many things to recover, deleting all packages and reinstall the components, but still i get this error.

Please advice.............thank you very much in advance.......

Error inflating class android.support.v7.widget.Toolbar after updaring to v7.AppCompat Version 23.3

$
0
0

I am creating a Xamarin Forms Project and using android.support.v7.widget.Toolbar with FormsAppCompatActivity. The code I'm posting below was working with Xamarin.Android.Support.v7.AppCompat Version: 23.0.1.3

But after I upgraded to 23.3.0 this has started throwing Android.Views.InflateException: Binary XML file line #1: Error inflating class android.support.v7.widget.toolbar exception.

Here is my code for MainActivity

[Activity(Label = "AppMob.Client", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {

        protected override void OnCreate(Bundle bundle)
        {
            FormsAppCompatActivity.ToolbarResource = Resource.Layout.toolbar;
            FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs;

            base.OnCreate(bundle);

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

            Xamarin.FormsMaps.Init(this,bundle);
            GoogleAnalyticsHelper.GetGASInstance().Initialize_NativeGAS(Application.Context);  //For GA initialization
            LoadApplication(new App());
        }
}

This is my code for Resource.Layout.toolbar

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

How to change the name of app(In the screen, under the icon)

$
0
0

Hi guys,

I am building an app in Xamarin.Forms. I want to change the name of app, both iOS and Android. I tried to change the information in mainactivity.cs and Androidmanifest. However it is not working. I also don't know how to do it in iOS.

Would you please to help me?

Thank you very much.


Slider control as audio seekbar

$
0
0

Hi,
I'm writing a simple media player using Dependency services to play an mp3 file. While the sound is playing it updates a "slider" in the main forms window. everything works fine so far, now I just want the slider to pause the mp3 and then jump to the position that relates to where the user drags the slider, just like a normal seekbar but I can't find any information on how to pickup events from when the user interacts with the slider other then the "value changed event" that will be raised all the time since the code change this value from the player on each platform. Does someone know how tho get events from this user interaction with the slider?

Best Regards
/magnus

Unfortunately, my Application has stopped!!!

$
0
0

one page of my application it contains carousal view it works fine , but sometime when i move between pages i got this error "unfortunately my application has stopped ".
the problem is : when i use emulator this error does not appear, but when i use my real device this happen sometimes.
another note when i debug the application on the real device and when this error appear , application stopped but didn't go back to the code.

any suggestion please ?

Best FORMS starter project for Azure

$
0
0

I am looking for a robust starter project that uses Azure as a backend. I like the CRM and Sports samples on the site but they have not been touched in 2 years. Both seem to have compile errors.

I have spent some time on the GIT HUB, but many of them don't compile either.

My dev environment is latest VS on Mac or VS 2017 on Windows. I need to build a quick app for a non -profit on iOS and Android. Each user will have their own data and need to be identified in the application uniquely.

Thank you.

cannot open axml view in VS 2017 - error "Create session failed"

$
0
0

Has anyone seen this before? I get this when trying to view the layout in VS 2017. Seems to me that there is some configuration problem 32/64 bit but not sure what it is.

Thanks!

How to detect inactivity of all the platform in common

$
0
0

Hi Everyone,
I built the application for Xamarin forms and I need to handle the inactivity.

If the user and the application don't have the interaction more than 120 seconds, I have to trigger the alert that "Application logged out due to inactivity".

Is it possible to handle? Please suggest your comments in details.

Frame scaling

$
0
0

hello!,

i have an issue with my frame...

im triyng to scale my frame with the content inside of my listview it sorta looks like

<Frame Grid.Row="2" x:Name="framePeople" TranslationY="-100" HeightRequest="850">

    <StackLayout x:Name="StacklayoutPeople">

        <ListView x:Name="ListPoeple">

            <ListView.ItemTemplate>

                <DataTemplate>

                    <ViewCell>

                        <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="AUTO" />
                                                    <ColumnDefinition Width="AUTO" />
                                                    <ColumnDefinition Width="AUTO" />
                                                </Grid.ColumnDefinitions>

                        <Label Text="{Binding Voornaam}"
                                                        FontSize="Medium"
                                                           FontAttributes="Bold"
                                                        Grid.Column="0" />

                                                <Label Text="{Binding Achternaam}"
                                                           Grid.Column="1"
                                                           FontSize="Medium"
                                                           HorizontalOptions="Start" />
                                        </Grid>
                                    </ViewCell>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
                    </StackLayout>
                </Frame>

i don't want to have a heightrequest that just says 850..i wan't to scale it with my current content..

is there an easy way to do this?

Detect Inactivity of the App

$
0
0

Hi,

 Can you people help us regarding, how to detect the inactivity or idle time in xamarin forms cross platform application. We have to do auto logout, after 15 mins on idle time.

Thanks & Regards,
Manigandan V.


apns-collapse-id in Xamarin Forms Ask Question

$
0
0

FCM _CollapseId_Bug(https://github.com/firebase/quickstart-ios/issues/68") Latest comment on the link says apns-collapse-id is now supported. I tried to send the request with apns-collapse-id in the request header using the postman, but still the FCM messages are not collapsing on iOS devices.

Has anyone tried and successfully implemented this.

TIA!

How to display the data in table format.

$
0
0

I want to display the data in table structure like shown in attachment. I want Table Header as constant and the data will scroll.

Thanks..

I created distribuition version but how can i do to distribute?

$
0
0

I followed this example
to generate a distribuition version of my App. Well, generated some files, but how do i distribute these files? What file my client do get to install? In my folder i have:

app-icons folder
mdbs folder
signed-apk folder
archieve.xml
com.inetglobal.autorizador.br.apk(file)

How my client will install in your device?

Images in ListView - best practices?

$
0
0

Hello.

I have a few question about the best approach for handling images in ListView cells

1) If I have a background image that is shared in more than one cell, should I create it outside the cell and pass a reference for the image to the ViewCell? - I use an absolute layout inside the individual view cells, so the image location will be the same within each cell... which leads me to the next question
2) what if the image position is not the same in each cell?

Let's say in list I have a pictures of people and given condition that can change over time, I want to decorate some people with a different image or change the background
3) What is the best/recommended way to change an Image in a cell?

Thanks,

Erez

Horizontal ListView

$
0
0

How can I implement listview items horizontaly in xamarin.forms...I attach the sample image with this

Viewing all 77050 articles
Browse latest View live


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