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

Xamarin Forms: sets text and display size to default while device it is configured large

$
0
0

Hi all,
I'm having a problem on xamarin ios and android. if the device has set the text and display size to large, all the sizes in my app become enlarged.
how can I set the default when opening the app?
I have no idea where to put or disable the system configuration of the text or display size. I have tried using this help:

    using Xamarin.Forms;
    using Xamarin.Forms.Platform.Android;

    [assembly: ExportRenderer(typeof(Label), typeof(MyApp.Droid.Renderers.LabelRendererDroid))]
    namespace MyApp.Droid.Renderers
    {
        class LabelRendererDroid : LabelRenderer
        {
            protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
            {
                base.OnElementChanged(e);
                if (e.NewElement == null) return;
                Control.SetTextSize(Android.Util.ComplexUnitType.Dip, (float)e.NewElement.FontSize);
            }
        }
    }

but besides being obsolete, it is only for android.


Unhandled exception: System.ComponentModel.Win32Exception (0x80004005)

UIWebView AppStore Rejection Despite mtouch Flag

$
0
0

Hello, my Xamarin.iOS app is still getting rejected on upload to iTunes Connect based on UIWebView even after following the instructions found in other posts for adding the mtouch --optimize. Here is my mtouch line:

--optimize=experimental-xforms-product-type --warn-on-type-ref=UIKit.UIWebView

And here is the warning:

Warning MT1503: One or more reference(s) to type 'UIKit.UIWebView' still exists inside 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' after linking (MT1503)

And the dreaded AppStore rejection:

ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).

I have tried both "Link Framework SDKs only" as well as "Link All". Everything is fully updated on the Stable channels (VS Mac 8.5.4, and Xamarin Forms 4.6.0).

Any ideas what I might be doing wrong? Thanks!

Could not resolve type with token 01000012

$
0
0

I've been developing my app now for at least 5 months. I've been wanting to try the xamarin previewer so i updates visual studio xamarin forms and then i updated my nuget xamarin forms for my portable, ios and android.

now when i try to debug the application on the device i get

System.TypeLoadException: Could not resolve type with token 01000012

on this line

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

which i find very odd

origionally my xamarin forms nuget version was 2.3.3.168

so i thought id update to the stable version which was the same version number 2.3.3.168 but it had "stable" beside it

i've downgraded again but still get the same error.

any thoughts

thanks

how to handle Icons android tablet with mdpi resolution?

$
0
0

Some tablets have mdpi resolution like amazon firebase tablets. I have icon for each resolution folder defined but problem is that tablet is mdpi and icon in the mdpi folder is like 48x48 and when you define the icon on tablet, 48x48 is like tiny, if you define larger size, it is pixeled. what is the best way to handle it if svg is not the option. Should it be just put in drawable folder with the biggest size possible, so let it be resized on runtime?

My Xamarin.iOS app crashes on the simulator on startup, but then works?

$
0
0

I'm currently trying to test my Xamarin.iOS app on my Windows machine connecting through MacInCloud. When I attempt to debug the code, it will crash after about 10 seconds of the loading screen. After the crash, when I click on the app again, it gets past the loading screen and works fine. I debugged this way for a little, but without the ability of using breakpoints it's very difficult to find the other bugs.

This happens even with a blank template app.

Any ideas?

Consuming Stand-alone Resource Dictionaries

$
0
0

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/resource-dictionaries#stand-alone-resource-dictionaries

According to this documentation, it's possible to split the app styling into individual resources Dictionary, by modifying a content page /view .

I have done this, and moved a section of styling to this Dictionary, my problem is then access these resources from other content.

Normally I would define it in the App level resource Dictionary, and then consume by

Style="{StaticResource HeaderBackGround}"

This of course can't be resolved.

So how do you consume a Stand-alone Resource Dictionary?

Xamarin.Auth sign in displays wrong app name

$
0
0

When I use Xamarin.Auth to sign in it displays the wrong app name:
Choose Account to sign in to (a wrong app name displayed here instead of the app's name)

The Google Drive API key is set up for the correct package name. There was a sample that I setup a client key for back in 2017 with the name that is getting displayed. I'm wondering if I need to create another Google Drive API key? Anyone else running into this? The app is correctly uploading and downloading files from Google Drive it's just that the name is wrong for the sign in prompt (which might freak users out).


What are the measure units for FontSize and how to make it related to font height?

$
0
0

My main target to to set such FontSize on a Label that in the result the Label height would become the desired value. For example, I want the Label to be 50 Xamarin Forms units high what value should I use for the FontSize in this case? How to calculated FontSize from the font height?

CollectionView: System.MissingFieldException Field not found

$
0
0

Hello,
I've got System.MissingFieldException with CollectionView.
Exception message: System.MissingFieldException: 'Field not found: int .Style.AppCompatDialogStyle Due to: Could not find field in class'

Error occures when app goes to LoadApplication(new App()) in MainActivity Android class. In App class I have only setting MainPage to Page which contains CollectionView.
CollectionView is declared in XAML:

<CollectionView ItemsSource="{Binding TripList}">
                <CollectionView.ItemsLayout>
                    <GridItemsLayout Orientation="Vertical"
                        Span="2" />
                </CollectionView.ItemsLayout>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <ImageButton 
                                    Clicked="Trip_Clicked"
                                    CommandParameter="{Binding ID}"
                                    Source="{Binding ImageURL}"
                                    BackgroundColor="Transparent"
                                    HeightRequest="100"
                                    WidthRequest="125"
                                    Margin="0,15,0,0"/>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>

TripList is List of my objects which contains ImageURL as string, and ID as GUID.

When I delete CollectionView from my Page, app starts without any error, but I need that. Additional, sometimes CollectionView works without any problem, but problem returns after uninstalling app.

Screenshot of exception:

More info:
Xamarin.Forms ver. 4.6.0.800
Xamarin.Android.* ver. 28.0.0.3
.NET Standard 2.0
API Level 28

Extremely long build with xamarin forms android

$
0
0

Hi,

I have a xamarin forms project with Xamarin.Forms v4.5 with Vs 2019.

And I compile with using Android 10.0 Q.

When I build in debug mode it's extremely long.

In my output it hangs 10 minutes on the line:

1>------ Build started: Project: Dev.Mobile.Android, Configuration: Debug Any CPU ------

Once it passes this step it's quite fast.

My setup for the build is:

What could bhe the issue? How can I investigate?

Thanks,

How to get Visual Studio Mac to use the Xamarin.Android framework that I built from Source.

$
0
0

I'm attempting to build Xamarin.Android from source on a mac and I tried following the instructions. I am able to get to the point where it compile successfully using the "make all" command.

At that stage, I need to get it into Visual Studio. After "make" it doesn't seem that Visual Studio uses it.

How do I get Visual Studio to use the new Xamarin.Android that has been build.

There are instructions on how to build Mono.Android.dll and Mono Runtime and Mono Binaries. I'm not sure if I need to follow them.

I've also tried building the Mono Runtime and Binaries using "make rebuild-mono". I get the error:
MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.

I also tries to build Mono.Android.dll using "make framework-assemblies". It is successful. But again, it doesn't seem that Visual studio is using the build that I did.

Anybody know what I need to do, to get Visual studio to use the Xamarin.Android that I just built?

how to Upload file To Web service ?

$
0
0

Hi
I trying to upload files from the mobile app using Web Service.
But after Pick File I could not send the file to the web service
Suppose the web service is located at the following address:
www.haythamweb.com/myServices.asmx/uploadfiles
And I have two parameters:
byte[] fileContent, string fileName

This is the code for the web service:
[WebMethod]
public string UploadFile(byte[] fileContent, string fileName)
{
try
{
MemoryStream ms = new MemoryStream(fileContent);
FileStream fs = new FileStream
(System.Web.Hosting.HostingEnvironment.MapPath
("~/TransientStorage/") +
fileName, FileMode.Create);
ms.WriteTo(fs);
ms.Close();
fs.Close();
fs.Dispose();
return "OK";
}
catch (Exception ex)
{
// return the error message if the operation fails
return ex.Message.ToString();
}
}

This is the code for the upload button I could not complete:

private async void Button_Clicked(object sender, EventArgs e)
{
var file = await CrossFilePicker.Current.PickFile();

        if (file != null)
        {
            lbl.Text = file.FileName ;
        }

        String URI = "http://haythamweb.com/myServices.asmx/uploadfiles";
       ...........................
       ...........................
       ...........................
       ...........................
    }

can you help me

How to implement readmore in listview items?

$
0
0

How to implement need readmore and read less inside listview item as it expand and collapse content respectively?

How to Create Local Notification In Xamarin.Forms for Android,IOS,Uwp

$
0
0

How to Create Local Notification In Xamarin.Forms for Android,IOS,Uwp


Why propertychanged value is null after changing the property value?

$
0
0

Hi Guys,
I am new to C# and Xamarin, so I spoiled one day to find a solution this issue, but I couldn't.
Can anyone tell me why PropertyChanged value comes null in INotifyPropertyChanged. I have a property and I change its value, but when it enters in NotifyPropertyChanged method the value of PropertyChanged is null. Following is my code :

ViewModel

    private UserLoginResponseModel _userData;
    public LoginResponseModel LoggedUser { get; set; }

    public event PropertyChangedEventHandler PropertyChanged;

    public string ImgSource
    {
        get { return _userData.profile_pic; }
        set
        {
            if (_userData.profile_pic != value)
            {
                _userData.profile_pic = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ImgSource"));
                //OnPropertyChanged("ImgSource");
            }
        }
    }


    public UserViewModel()
    {            
        LoggedUser = LoggedInUser.GetUser();
        _userData = new UserLoginResponseModel();
        _userData = LoggedUser.user;
    }`

Xaml Code

             <Image HorizontalOptions="Center"
                                              VerticalOptions="Center"
                                              x:Name="ImgProfilePic"
                                              Source="{Binding ImgSource,
                                              Converter={StaticResource arrayTomageConverter},Mode=OneWay}" >
                                           <Image.BindingContext>
                                                <vm:UserViewModel />
                                            </Image.BindingContext>
                                       </Image>`

Xaml Code behind

    UserViewModel userViewModel;
    public EditProfile()
    {
        userViewModel = new UserViewModel();
    }

    userViewModel.ImgSource = NewImage;

Location Foreground Service

$
0
0

HI

I have a foreground service that is stared with StartForegroundService. I request permission for Coarse and Fine location from user.

The issue is the access to location services goes away when app is not in use. The permission requested by android to the user is "Only while app is active".

How do I set the permission to ask for "Always on" permission. Or do I need to change my foreground service.

I see the Android documentation recommends starting the foreground service with a type 8 "location 8 GPS, map, navigation location update.", but i don't see how to do that in xamarin platform.

I'm developing on android Q.

Any help would be appreciated.

Application not support for Different types of screens

$
0
0

hi

I want to make an application that supports Different types of phone screens and I tried this way.
Note ? that I have modified every folder(small,m,l,xl) that supports a device inside the interface, but nothing appears in the application on different devices in terms of size and dimensions.

Problem when turning on the flashlight

$
0
0

hi

Problem when using the flash light while reading in the OCR libraries The flash stops and there is no way to turn it on

ListView Not Scrollable

$
0
0

I have a layout with a listview and below it a "toolbar" I want the list to be scrollable i Used verticaloptions="fillandExpand" but doesn't help

The following is my layout

<?xml version="1.0" encoding="utf-8"?>


    <Toolbar
        android:id="@+id/toolbar_bottom"
        android:minHeight="?android:attr/actionBarSize"
        android:background="?android:attr/colorAccent"
        android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
        android:popupTheme="@android:style/ThemeOverlay.Material.Light"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"/>

Looking foward to your kind help :)

Regards

M.R

Viewing all 204402 articles
Browse latest View live


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