# Visual Basic > Xamarin >  my war with xamarin (visual studio C#)

## bugsi

here are the things that simply don't work or don't have a walkthrough or raises errors
in xamarin :

the emulator, yes it is possible to lunch apps on the smartphone but the emulator doesn't workget  news feedwearable apps get the image capture or screen capture in realtime and fast many times automatically without the user
pressing anything get volume level openGL apps nothing works, it is impossible to create game apps smart TV apps create a native app chatphone recorder while app is closed : autosave, playback, deleteliving wall paper + get b8Tri level, get temperature on the wallpaper of the phonesend notifications while app is closed + click notification to open appalarm clock while app is closed + pause replay alarm how to connect a game app to google play how to delete file on the phone from the app. save to external SDcard change the apps background image programmatically without changing activity

where did I search for those walkthroughs ? all over the web and tried the tutorials of :
 Jason Smith, Eric Maupin, Stephane Delcroix, Seth Rosetter, Rui Marinho, Chris King, E.Z. Hart, Samantha Houts, Paul DiPietro, and interim product manager Bryan Hunter

and the tutorials of tiffany ford and james montemango.

bottom line is their tutorials for some reasone don't work and I therefore, at this moment, deem xamarin a failure !
yes it may work on their blogs and video channels but they have the real access to the "how to" and we don't
and it doesn't work.

----------


## bugsi

oh yeah, and every app that is not a single view app
yes the blank apps also don't work.

----------


## Sitten Spynne

Yes, since the things you saw in videos don't work on your computer, it's much more likely there's some large-scale conspiracy than that you have issues on your machine.

Pick one thing that isn't working for you and post your code, and we might be able to help you. I'm way more likely to help if it's iOS-oriented, the Android emulators are hot garbage and haven't been improving. Those are from Google, it's not Xamarin's fault. Xamarin was working on a good one but Microsoft canned it when the purchase was made. Microsoft was working on a good one but gave up because "the Google emulators are adequate", which was probably code for "trying to support Android is misery". 

There are reasons things aren't working, and blaming the tools isn't helping find them.

----------


## bugsi

lets start with the wearable apps :
I am using an android Samsung 7 edge
and a gear frontier 3 watch
tried a simple hello world : new project, visual C#, android, wearApp (android) 
the phone was connected to the computer, launched the app and it showed only on the phone, and nothing happened with
the watch (and yes the watch was Bluetooth connected to the phone)

----------


## Sitten Spynne

I don't have an Android Wear device so I can't directly confirm.

Have you tried with emulators? Did that work? (I understand if you can't get an emulator working, Google's emulators are tough to wrangle.)

----------


## bugsi

when I use the emulators it shows a black screen emulator that doesn't do anything and visual studio stops responding.

how about #16 maybe you could help me with it please ?

----------


## Sitten Spynne

You said you solved that one.

----------


## digitalShaman

i have not seen a usable Emulator so far (i have not searched too Long though), but i have done #6: OpenGL

----------


## bugsi

> You said you solved that one.


It was solved by using a second activity but I want a smooth transition for the screen change so it is needed to
change the apps background image programmatically *without*  changing activity

----------


## bugsi

> i have not seen a usable Emulator so far (i have not searched too Long though), but i have done #6: OpenGL


I don't have any tutorials on how to use openGL and what it can do so I can only get that color cube default app.
it unexpectedly worked today for some reason:


```
using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Content.PM;

namespace App21
{
    // the ConfigurationChanges flags set here keep the EGL context
    // from being destroyed whenever the device is rotated or the
    // keyboard is shown (highly recommended for all GL apps)
    [Activity(Label = "App21",
                    ConfigurationChanges = ConfigChanges.KeyboardHidden,
                    ScreenOrientation = ScreenOrientation.SensorLandscape,
                    MainLauncher = true,
                    Icon = "@mipmap/icon")]
    public class MainActivity : Activity
    {
        GLView1 view;
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create our OpenGL view, and display it
            view = new GLView1(this);
            SetContentView(view);
        }

        protected override void OnPause()
        {
            // never forget to do this!
            base.OnPause();
            view.Pause();
        }

        protected override void OnResume()
        {
            // never forget to do this!
            base.OnResume();
            view.Resume();
        }
    }
}
```

----------


## bugsi

when I tried to do the watch app it installed something that looked like some nugget pack which may have enabled the openGL

----------


## Sitten Spynne

> It was solved by using a second activity but I want a smooth transition for the screen change so it is needed to
> change the apps background image programmatically *without*  changing activity


This makes no sense to me so I think I don't understand the question.

Pages have a background image and you can set that whenever you want. That's what I think of when I think "background image". What exactly are you talking about? Can you show me the code you had to write to accomplish your task? Maybe that'll show me what you really mean. It'll at least give me something to try and reproduce.

----------


## bugsi

https://yotamarker.justforum.net/t12...ckground-image
using the 2nd activity solution you can see the screen flip over and not a smooth ideal transition you would get by changing the main activitys background.

----------


## Sitten Spynne

I've been really swamped at work so I haven't tried to test, but help me understand this:

Why can't you set the background image for pages, instead of trying to set it for activities? My understanding of Android Activities is there are a lot of things you just can't do without the OS destroying the current Activity to create a new one. That's not Xamarin's fault, it's Google's choice to make that the case.

----------


## bugsi

because the background is not some widget. I haven't a clue how to refer to it, how to access it.

for setting an image in an image widget for example :

adding images aka pictures :
add the widgt imageview
add an image file to the draweble folder in the resources folder
asuming the image name added was mic.whatever add code :


```
ImageView IV1 = FindViewById<ImageView>(Resource.Id.imageView1);
            IV1.SetImageResource(Resource.Drawable.mic);
```

----------


## Sitten Spynne

Ahh, I get it now.

See, I'm a Xamarin Forms developer. That's why everything was so confusing for me. In my world, we transition between Pages and each Page has a background image. The application itself also has a sort of concept of a background. That gets translated into different native iOS and Android concepts and I don't have to think about them.

As far as I can tell, an Android "Activity" is the concept I think of as a "Page". The trouble I see is it looks like the Android SDK indicates moving between two activities always destroys the "source", and it's your job to persist what you need to know to restore its state if the user returns. That might imply there's not a way to maintain a consistent background image as you transition between two Activities, but that sounds stupid so I bet it's not true.

I tried to have a look at Xamarin.Android to see if I could train myself up enough to answer, but then work got really busy. When you're working in Xamarin.Android, you actually can get good answers if you ask Android developers what to do. Since Xamarin.Android is just a C# wrapper around the Java APIs, if you can find code to do what you want in Java it's usually a brainless translation to C#. So maybe try that, some work that's just been put on me implies I'm not going to have enough free time to learn this for a while.

----------


## bugsi

again, my personal opinion is that the makers of xamarin are keeping the essencial code walkthroughs to themselfs. microsoft and xamarin could solve this in less then a minute, problem is I don't know how to reach those specific people.

----------


## Sitten Spynne

Post your question on stackoverflow.com, those are more or less the de facto forums for Xamarin. 

But again I reiterate: you are complaining about basic facts of Android architecture and I'm pretty sure you need to talk to an Android developer to get the correct answer. Blaming Xamarin isn't going to get you to the answer faster than that.

----------


## bugsi

stackoverflow.com is search engine result waste.
useless to me

----------


## Sitten Spynne

I found some answers to your question on StackOverflow in twenty seconds. Thing is: they're not all copy-paste hold-your-hand answers. One of them is a general thing that might not be doable from Xamarin Android unless it uses the weird "I can't believe it's not XAML" Android layout markup language. The other one is a comment on a no-answer thread that says to do it basically the way Xamarin Forms does it: one Activity hosting many Fragments it swaps out.

The sense I get from the amount of answers to the questions I find is "this is not a common thing Android apps do", even though I think it's a sensible requirement. The only other possible thought is, "The suggestion to use multiple Fragments is so obvious and works so well even newbies figure it out." I'm not directly an Android developer so I can't tell which is right.

----------


## bugsi

fragments ???
at any rate, I am starting to think maybe there is something that converts computer .exe files into apps.

----------


## bugsi

also, it doesn't surprise me you found answers on stack over flow , the thing is nothing there works it is a click bait site.

----------


## Sitten Spynne

Yes, Fragments.

If you can't transition between two Activities while maintaining a consistent background image, it seems like you _can_ make one Activity that manages multiple Fragments and transitions between them instead.

----------


## bugsi

tried your fragment solution :
it errors.
this XAML :


```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
        android:id="@+id/myButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
  <fragment    android:name="Fragment_Project.FragmentOne"    android:id="@+id/fragment_place"  android:layout_width="match_parent"    android:layout_height="match_parent" />
</LinearLayout>
```

errors once I add the fragment :


```
 <fragment    android:name="Fragment_Project.FragmentOne"    android:id="@+id/fragment_place"  android:layout_width="match_parent"    android:layout_height="match_parent" />
```

----------


## bugsi

Unhandled Exception:

Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment occurred

----------


## bugsi

xamarin is a sick joke and a cruel waste of time !  :Mad:

----------


## Sitten Spynne

You are never going to get very far if you blame any failure on your tools. So far, every step of the way, the problem has been "bugsi can't possibly have made a mistake, it must be Xamarin's fault". Here we are again.

I linked you to Android documentation. Android doesn't use XAML. Android uses AXML or some other "whoops we want XAML but won't use Microsoft's solution" name. They are mostly the same, but slightly different. When I looked for Xamarin Android fragments, I found a nice walkthrough on Xamarin's site, and there's a very obvious thing missing from your XAML if you casually glance at the walkthrough.

But you shouldn't casually glance at it, you should actually do the walkthrough so you can verify it works. (Like I did.) If it doesn't, something is wrong on your machine. Blaming Xamarin won't fix it, reinstalling might. Welcome to programmer tools, it's a miracle when they work. Let's practice:

Try the walkthrough, and if it doesn't work, instead of destroying your room like Kylo Ren, do a Google search for the error message. Read several articles, and see if those people solved their problem. If not, post it here and admit the possibility the problem is on your end, not the tool that's working for thousands of other people.

----------


## bugsi

I also updated VS this week, and tried this on 2 machines on win 10 and win8.1. this is beyond my end clearly. they need to provide support for their products or they WILL collapse. they need to admit the truth of why it isn't working for me and only working in india and on james montemagno 's machine, and have charles petzold come to my house and walk me through how to get those solutions to work. just saying what I believe.

----------


## Sitten Spynne

I guess everyone who uses it is wrong then, you tried copy/pasting and didn't read error messages therefore it's a bad product.

I'm out. It feels like I'm dealing with me.

----------


## bugsi

I broke a chair and ripped a notebook I hope you're happy team xamarin !!!

----------


## bugsi

as I said Xamarin will be destroyed !

-link removed by moderator-
and that's not even getting warmed up yet

----------


## Lord Orwell

i'm not sure what the solution is in xamarin, but android has containers you store pages in and they aren't destroyed when flipping between them unless you explicitly destroy the old one.  It's how the back button functions.

----------


## bugsi

> i'm not sure what the solution is in xamarin, but android has containers you store pages in and they aren't destroyed when flipping between them unless you explicitly destroy the old one.  It's how the back button functions.


yes I am using android studio, I have all the walkthroughs here :
http://www.lulu.com/shop/moti-barski...-23839016.html
xamarin is garbage tbh

----------


## bugsi

> i'm not sure what the solution is in xamarin, but android has containers you store pages in and they aren't destroyed when flipping between them unless you explicitly destroy the old one.  It's how the back button functions.


yes I am using android studio, I have all the walkthroughs here :
http://www.lulu.com/shop/moti-barski...-23839016.html
xamarin is garbage tbh

----------

