Archive for 'Ui'

UIAlertView without Buttons

UIAlertView *alert;


alert = [[[UIAlertView alloc] initWithTitle:@"Are you sure..." message:nil delegate:selfcancelButtonTitle:nil otherButtonTitles: nil] autorelease];

[alert show];

UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);

[indicator startAnimating];

[alert addSubview:indicator];

[indicator release];




[alert dismissWithClickedButtonIndex:0 animated:YES];

[alert release];


Android Audio Manager

AudioManager allows your application to control the phone’s media volume either by pressing the hardware volume buttons on the phone or programmatically.

Setting Maximum Vloume

AudioManager mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
int maxVol = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVol, AudioManager.FLAG_PLAY_SOUND);

// OR

mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVol,


// OR

mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVol,

// Etc..

The last parameter in setStreamVolume(), denotes flags. These control how the user is indicated of the volume change.
FLAG_PLAY_SOUND – play a system beep to indicate the volume

FLAG_SHOW_UI     – displays a toast notifying the user that the media volume has been changed
FLAG_VIBRATE     – vibrates your phone.

mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE,


ADJUST_LOWER     Decreases the volume.
ADJUST_RAISE     Increases the ringer volume.
ADJUST_SAME    Maintains same Volume



Sensor Manager constants in android

Sensor manager contains the following constraints that let you select a suitable update rate.


  • SensorManager.SENSOR_DELAY_FASTEST Specifies the fastest possible Sensor update rate
  • SensorManager.SENSOR_DELAY_GAME Selects an update rate suitable for use in controlling
  • games
  • SensorManager.SENSOR_DELAY_NORMAL Specifies the default update rate
  • SensorManager.SENSOR_DELAY_UI Specifies a rate suitable for updating UI features

The new Samsung Beam is a Android 2.1 mobile phone featuring a large 3.7-inch Super AMOLED touchscreen display,8 megapixel camera, and a pico projector .


The new mobile phone also sports the TouchWiz 3.0 UI on top of Android, the same as Samsung Wave, the first bada-powered smartphone, does, but it has a larger screen than the latter. Moreover, users will also enjoy an 8-megapixel photo snapper with auto focus and flash with Beam, which can also provide 720p / 30fps video encoding / decoding. Not to mention that it comes with that integrated pico projector, which both extends its functionality and makes it much more appealing to customers.

A fragment is a new framework component that allows us to separate distinct elements of an activity into self-contained modules that define their own UI and lifecycle. To create a fragment, we must extend the Fragment class and implement several lifecycle callback methods, similar to an Activity. We can then combine multiple fragments in a single activity to build a multi-pane UI in which each pane manages its own lifecycle and user inputs.

We can also use a fragment without providing a UI and instead use the fragment as a worker for the activity, such as to manage the progress of a download that occurs only while the activity is running.

Features of Fragment:

1. Fragments are self-contained and you can reuse them in multiple activities

2.  Add, remove, replace and animate fragments inside the activity

3.  We can add fragments to a back stack managed by the activity, preserving the state of fragments as they are changed and allowing the user to navigate backward through the different states

4.  By providing alternative layouts, you can mix and match fragments, based on the screen size and orientation

5. Fragments have direct access to their container activity and can contribute items to the activity’s Action Bar