Indeterminate Progress displayed by default in Android 4.0.3 - android

So I have this small code which enables the indeterminate progress feature:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_main);
}
And I know that unless setProgressBarIndeterminateVisibility(true); is not called, the progress bar is not displayed. However this does not seem to be true when the above code runs on a device with Android 4.0.3. On this device the progress bar is displayed permanently without issuing a call to explicitly set the progress bar visibility to true.
Any ideas why and how to fix this?

Did you try these
supportRequestWindowFeature(Window.FEATURE_PROGRESS);
requestWindowFeature(android.view.Window.FEATURE_PROGRESS);
requestWindowFeature(android.view.Window.FEATURE_INDETERMINATE_PROGRESS);
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

Related

react-native-smart-splash-screen android status-bar issue

I am using
react native smart splash screen.
my question is
is there any way to hide status-bar on splash screen in android ?
(its working fine in ios).
On MainActivity.java, just like that:
#Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, true); // <- second parameter is true, to hide StatusBar
super.onCreate(savedInstanceState);
}
source: https://github.com/crazycodeboy/react-native-splash-screen/issues/105#issuecomment-401966983

Android view rendering issue - screen painting not happening on time

I'm trying to create a simple loading screen, during which I create new background thread, check some settings, and then start my main activity. I don't need the status bar / activity bar during this time, and I'm executing code to hide it.
During prototyping i'm using system.sleep to simulate waiting. I intent to add a delay of 1 second in my final version to prevent flashing.
However, it seems that system.wait is always happening before the screen is painted (see code below). My understanding was that by the time onResume is called Android will have painted the screen already, but that doesn't seem to be the case. Is there a different way something like this should be implemented?
Code below:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading_screen);
//hide action bar / system bar
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
ActionBar actionBar = getActionBar();
actionBar.hide();
}
public void onResume(){
super.onResume();
//TODO: Start a background thread. Wait during prototyping instead
SystemClock.sleep(3000);
}
You can use Handler for waiting to not hold the UI thread.
check this.

Showing indeterminate progress in Sherlock Action Bar

i`m trying to show indeterminate progress bar in ABS v. 4.0.2 by following code
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.main);
getSherlock().setProgressBarIndeterminateVisibility(true);
}
on ICS virtual device it works fine, but progress do not shows in device with Android 2.1.
what i`m doing wrong?
Make sure you import com.actionbarsherlock.view.Window, not android.view.Window.
Try setSupportProgressBarIndeterminateVisibility(boolean) to get backward compatibility.
do this:
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.section_one1);
setSupportProgressBarIndeterminateVisibility(false);
on anything clickable like starting an activity via intent or adapters or whatever
show your progressbar on click
setSupportProgressBarIndeterminateVisibility(true);
but using this method when the user goes back to the activity the progress dialog will be visible still. There are many ways to stop it but the easiest one is just to use
#Override
public void onBackPressed()
{
NavUtils.navigateUpFromSameTask(this);
super.onBackPressed();
}

How to switch to real full screen on Android 2.2?

I found bunch of samples how to remove title/notification bar on Android. However, it's still not a full screen.
I still see a panel on my table with search, home, back and some other button.
Do you have any ideas how to hide this panel?
Generally speaking, I want kind of kiosk mode.
Use this code in onCreate of activity:
getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN);
Sample code for a fullscreen activity:
public class HellofullActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
where you request that the window has not the green title bar and take full screen.
The core problem was device specific. I was doing development for Archos and Archos has it's own bar, which isn't not removed by FLAG_FULLSCREEN and FEATURE_NO_TITLE

how to show progress dialog in oncreate in android app

In onCreate() of the activity, I'm force changing the orientation of the activity from portrait to landscape. This is working but there is a small delay of about a sec in the emulator. This activity is actually one of the tabs. So when the user clicks on the tab he would expect an immediate response. So I want to show a progress dialog until the view is completely loaded. How do I achieve this? I tried to do the below but it doesn't work,
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chart);
ProgressDialog dialog = new ProgressDialog(this);
dialog.setMessage("Loading...");
dialog.show();
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
.
.
.
dialog.dismiss();//after the view is loaded completely }
Any suggestion is appreciated.
Actually, I don't think your application is visiable yet .. not at the onCreate(). Check the eventing lifecycle ... onResume or maybe onStart ... where ever your Acitivity is actually visiable is where you should do this.

Categories

Resources