Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8219741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:17:00+00:00 2026-06-07T13:17:00+00:00

Possible Duplicate: Android Activity Life Cycle I am able to create a simple Splash

  • 0

Possible Duplicate:
Android Activity Life Cycle

I am able to create a simple Splash Screen for my app using Themes and it works just fine. However, there may be times that the app needs to refresh a large amount of data and I want to display a ProgressBar to the user letting them know what’s going on while they wait. So I ditched the Theme and created a layout resource and set that as the ContentView for my Splash Activity, but nothing displays. Not only does none of my content display (completely black screen) but the title bar continues to show up despite trying to hide it every way possible.

Splash.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:gravity="center">
<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="15dp"
    android:src="@drawable/logo" />
<LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center">
    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp" />
    <TextView
        android:id="@+id/progressText"
        android:text="Loading..."
        android:textSize="20dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5dp" />
</LinearLayout>

Splash.cs

[Activity(MainLauncher=true, NoHistory = true)]
public class Splash : Activity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        RequestWindowFeature(WindowFeatures.NoTitle);

        Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

        SetContentView(Resource.Layout.Splash);

        string lastUpdated = PreferenceManager.GetDefaultSharedPreferences(this).GetString("LastInventoryUpdate", null);

        DateTime lastUpdateDate = Convert.ToDateTime(lastUpdated);

        TimeSpan span = DateTime.Today - lastUpdateDate;

        if (string.IsNullOrEmpty(lastUpdated) || span.Days > 30)
        {
            TextView progressText = (TextView)FindViewById(Resource.Id.progressText);
            progressText.Text = "Updating parts database.  May take several minutes...";
            InventoryRepository repository = ((MyApp)Application).Inventory;
            repository.Execute();
        }

        StartActivity(typeof(Login));
    }
}

Still shows logo and title in the title bar and absolutely nothing for content. Even tried taking all the AsyncTask and StartActivity stuff out and just tried loading the Activity with the splash layout. It does eventually show up, but it shows as the black screen for a long while first. Can’t imagine why as this is my main launcher and there is literally nothing going on but setting the content of the activity.

And as far as the TitleBar showing up, I’ve also tried adding this to my manifest (which I currently have working in another activity just fine)

<activity android:name="app.MyApp.Splash" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity>

If I include a Theme for the activity, the TitleBar goes away, but my layout resource never displays.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:17:03+00:00Added an answer on June 7, 2026 at 1:17 pm

    Wouldn’t you know after struggling all day I figured out a large part of the problem minutes after posting. In short, I put the Theme back on the Splash Activity which now shows while everything is initially loading and usually redirects to Login before the content is ever set, which is perfect. But I changed my OnCreate as follows:

    [Activity(MainLauncher=true, NoHistory = true,  ScreenOrientation = Android.Content.PM.ScreenOrientation.Landscape, Theme = "@style/Theme.Splash")]
    public class Splash : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
    
            RequestWindowFeature(WindowFeatures.NoTitle);
    
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
    
            SetContentView(Resource.Layout.Splash);
    
            string lastUpdated = PreferenceManager.GetDefaultSharedPreferences(this).GetString("LastInventoryUpdate", null);
    
            DateTime lastUpdateDate = Convert.ToDateTime(lastUpdated);
    
            TimeSpan span = DateTime.Today - lastUpdateDate;
    
            if (string.IsNullOrEmpty(lastUpdated) || span.Days > 30)
            {
                SetTheme(Resource.Drawable.bg_black);
                TextView progressText = (TextView) FindViewById(Resource.Id.progressText);
                progressText.Text = "Updating parts database.  May take several minutes...";
                InventoryRepository repository = ((MyApp) Application).Inventory;
                repository.Execute();
            }
            else
                StartActivity(typeof (Login));
        }
    }
    

    Main difference is that I only call StartActivity if I’m not running my AsyncTask. Otherwise, I call StartActivity from OnPostExecute of my AsyncTask. Also, be sure to set the background property of all your views in the splash layout. Since I left the theme on the activity, if you don’t do this, your theme will show up as the background for EVERY view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Android Activity Life Cycle - difference between onPause() and OnStop() Can anybody
Possible Duplicate: Android Activity Life Cycle - difference between onPause() and OnStop() I was
Possible Duplicate: Android Activity Life Cycle - difference between onPause() and OnStop() What is
Possible Duplicate: Android create shortcuts on the home screen I am having one TextView
Possible Duplicate: Disable back button in android in my app to from one activity
Possible Duplicate: Flip-Animation for Activity-Change I'm new to Android Animation . I wanted to
Possible Duplicate: How to pass object from one activity to another in Android I
Possible Duplicate: Android: How to create slide (on/off) button I want to create sliding
Possible Duplicate: Why does Android app run in small window on tablet emulator? i
Possible Duplicate: How to detect when an Android app goes to the background and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.