[RESOLVED] xamarin: how to set the background image of the app ?-VBForums
Results 1 to 17 of 17

Thread: [RESOLVED] xamarin: how to set the background image of the app ?

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    52

    Resolved [RESOLVED] xamarin: how to set the background image of the app ?

    how to set the background image of the app programmatically in xamarin visual studio C# ?

  2. #2
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,143

    Re: xamarin: how to set the background image of the app ?

    You have some Page that is being displayed at any time. it has a BackgroundImage property. Set that property, and your "app" has a background image.
    Nothing I post is production-ready. It is provided as-is, use it at your own risk.

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    52

    Re: xamarin: how to set the background image of the app ?

    I already know how to set the BG property
    I need to set it programmatically ! in order to use many different background images !
    to be able to change the background image WHILE the app is running
    programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically !!!!!!! not manually !

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    39,417

    Re: xamarin: how to set the background image of the app ?

    Thread moved from the 'General Developer' forum to our brand new 'Xamarin' forum

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,256

    Re: xamarin: how to set the background image of the app ?

    Quote Originally Posted by bugsi View Post
    I already know how to set the BG property
    I need to set it programmatically ! in order to use many different background images !
    to be able to change the background image WHILE the app is running
    programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically programmatically !!!!!!! not manually !
    Sooo.... what's the problem? form.background = image.... It's a property. You set it like any other property, no? As long as you have a valid image loaded, you should be able to just set it.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    52

    Re: xamarin: how to set the background image of the app ?


  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,256

    Re: xamarin: how to set the background image of the app ?

    No it's not a problem. It's actually not complaining about the background property... it's complaining about the form name... is your Form named "form"? No, I think not... It's named something else. Hard to tell what it is from the screen shot MSTOW-something or other... Additionally since you're in the form, you should be able to use "this" ... this.background = ... anytime you're in a class, the this keyword will refer to that instance of that class. the property is there... you're just not accessing it correctly.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    Frenzied Member
    Join Date
    May 2014
    Location
    Central Europe
    Posts
    1,204

    Re: xamarin: how to set the background image of the app ?

    this is xamarin, so it is not that easy. there are no forms in that sense and there is no filesystem where you can easily load an Image from.
    so it is more complicated and not unusual for Newcomers to struggle.
    i thought about knocking an example together but as my time is limited and i also Need to Research this as i have no finished code, i was not yet able to. The 70$ were also not enough to motivate me during the week. maybe on the Weekend where i might have some spare time...

  9. #9
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,256

    Re: xamarin: how to set the background image of the app ?

    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  10. #10

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    52

    Re: xamarin: how to set the background image of the app ?


  11. #11
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,256

    Re: xamarin: how to set the background image of the app ?

    We're trying to help, but we're not getting any helpt back... posting pictures of your screen with silly comments on them doesn't help... 1) I can only see half the code, so I don't know what the second half of it looks like, you've also hidden the top part of it, so I can't even tell if it's in the right spot. 2) there's a red squiggly underneath the line in question... so presumably you've screwed it up somehow... and there should be an error message to go with it... but rather than go find out what it is, you decided it would be better to make fun of the language. Instead, spend the time and just copy/paste the code here instead. Be sure to put [code][/code] tags around it... I have my suspicions as to what's wrong, but I can't tell from a 1/4 screen shot of the code.
    Maybe someone else will help.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  12. #12

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    52

    Re: xamarin: how to set the background image of the app ?

    I placed it in the protected override void OnCreate(Bundle bundle)
    {

  13. #13
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,256

    Re: xamarin: how to set the background image of the app ?

    I'm beginning to think you're doing something you shouldn't be doing since you seem to be reluctant to share your code so I'm out.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  14. #14

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    52

    Re: xamarin: how to set the background image of the app ?

    @tg
    I don't have the energy to explain why the specific code is irrelevant so:

    Code:
    using System;
    using Android.App;
    using Android.Content;
    using Android.Runtime;
    using Android.Views;
    using Android.Widget;
    using Android.OS;
    
    namespace App15
    {
        [Activity(Label = "App15", MainLauncher = true, Icon = "@drawable/icon")]
        public class MainActivity : Activity
        {
            int count = 1;
    
            protected override void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);
    
                // Set our view from the "main" layout resource
                SetContentView(Resource.Layout.Main);
    
                // Get our button from the layout resource,
                // and attach an event to it
                Button button = FindViewById<Button>(Resource.Id.MyButton);
    
                button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
            }
        }
    }

  15. #15
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,143

    Re: xamarin: how to set the background image of the app ?

    Maybe you should take a nap and come back when you have the energy to be polite. I can see the problem clearly but I'm in too big a hurry to answer.
    Nothing I post is production-ready. It is provided as-is, use it at your own risk.

  16. #16

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    52

    Re: xamarin: how to set the background image of the app ?

    solved by moti barski

  17. #17

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    52

    Re: [RESOLVED] xamarin: how to set the background image of the app ?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.