My ImageView does not appear on my phone

0

I created a Layout and an Activity for this Layout.

In the Layout I only have an ImageView with a png image that is located in the Resources / Drawables.

When I do Debug in the Application ImageView does not appear on my phone's screen.

This is my XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="25px"
android:minHeight="25px"
android:gravity="center"
android:visibility="visible"
tools:visibility="visible">
<ImageView
    android:layout_width="350.0dp"
    android:layout_height="279.5dp"
    android:id="@+id/OpeningLogo"
    android:layout_gravity="center"
    android:visibility="visible"
    tools:visibility="visible"
    android:src="@drawable/logo"
    android:adjustViewBounds="true" />
</LinearLayout>

This is the code for my Activity:

namespace **********
{
    [Activity(Label = "xxxxxxxxx", MainLauncher = true, Icon = "@drawable/Logo")]
    public class OpeningActivity : Activity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Opening);

            Intent GoToLogin = new Intent(this, typeof(MainActivity));
            Thread.Sleep(5000);
            this.Finish();
            StartActivity(GoToLogin);
        }
    }
}

If you want me to put more data say.

Thank you in advance.

I have a copy of this question in StackOverflow English, if you give me the answer there, I'll post it here and vice versa.

    
asked by anonymous 15.04.2016 / 16:24

2 answers

1

Cheesebaron answered me with this in the English Overflow Stack, I already have the answer.

namespace *********
{
    [Activity(Label = "xxxxxxxxx", MainLauncher = true, Icon = "@drawable/Logo")]
    public class OpeningActivity : Activity
    {
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Opening);

            await Task.Delay(5000);

            var intent = new Intent(this, typeof(MainActivity));
            StartActivity(intent);
        }
    }
}

The problem was that I did not have time for the image to appear.

    
15.04.2016 / 18:24
0

Remove the line:

 this.Finish();
    
15.04.2016 / 17:56