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();
}
Related
I develop an android application and I need to prevent the user to close the application from navigation bar buttons .. there is another way to close the application.
I search a lot and didn't find any way to Permanently hide bottom navigation bar or at least stop all button control
Use this method to disable the Home button
#Override
public void onAttachedToWindow() {
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
If you meant to disable the back button on device, you could override
#Override
public void onBackPressed() {
super.onBackPressed(); //delete or comment this line
.......//do something you want
}
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);
I am using the code from this post to put a loading icon in the title bar of my Android App:
#Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.your_layout);
}
The code:
activity.setProgressBarIndeterminateVisibility(true);
is called in an AsyncTask. If the user navigates to a new activity, the icon is not longer present in the title bar since the icon was set for the first activity only.
Is there a way to have the icon show on all activities? Thanks in advance.
You can create super activity (i.e. Base Activity), include the below line in this super activity:
activity.setProgressBarIndeterminateVisibility(true);
And extends this activity to all the child activities.
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
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.