Sunday, 24 August 2014

Android Toggle Button Example

Toggle Button Example
The Toggle Button requires the use of the Toggle Button tag in XML activity

Create test_activity.xml


<ToggleButton 
android:id="@+id/togglebutton" 
android:layout_width="100px" 
android:layout_height="50px" 
android:layout_centerVertical="true" 
android:layout_centerHorizontal="true"
android:onClick="toggleclick"/>
Test.java
All we need to do is check the isChecked() method of the toggle button object inside our toggleclick() function.
public class Test extends Activity {

private ToggleButton togglebutton;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    togglebutton = (ToggleButton) findViewById(R.id.togglebutton);
}

public void toggleclick(View v){
    if(togglebutton.isChecked())
        Toast.makeText(TestActivity.this, "ON", Toast.LENGTH_SHORT).show();
    else
        Toast.makeText(TestActivity.this, "OFF", Toast.LENGTH_SHORT).show();
    }
}

Wednesday, 13 August 2014

Android L Camera 2 API Features Burst Mode, HDR+ and more

Camera 2 API

     The most important aspects of the new Camera API is a dramatic increase in performance over the previous interface. The Camera 2 system is now capable of delivering full resolution images at the same speed the hardware can capture them thanks to a fully synchronized pipeline model. This allows the Nexus 5 to achieve 30 frames per second while capturing 8 at it's maximum of 8 megapixels.
     In addition to the profound performance improvements, the new camera API also includes burst mode, Digital Negative format (similar to RAW), HDR+, and full manual control of capture and post-processing. Many of the finer control configurations can also be modified, including:


  • Exposure time
  • ISO Sensitivity
  • Frame duration
  • Lens focus distance
  • Flash trigger
  • Color correction matrix
  • JPEG metadata
  • Tonemap curve
  • Crop region
  • AE / AF / AWB mode
  • AE / AWB lock
  • AF trigger
  • Precapture AE trigger
  • Metering regions
  • Exposure compensation

Android L Preview API Changes

Type
Additions
Changes
Removals
Total
Packages
8
43
0
51
Classes and Interfaces
87
232
0
319
Constructors
84
2
0
86
Methods
408
69
17
494
Fields
754
22
1
777
Total
1341
368
18
1727

The overall difference between API Levels 20 and L-preview is approximately 3.77%.

Developers will be able to do more with your phone's camera in the L release



 New Packages


1. android.app.job
2. android.bluetooth.le
3. android.hardware.camera2
4. android.hardware.camera2.params
5. android.media.session
6. android.media.tv
7. android.service.voice
8. android.system






       This new camera API will be officially released in Android L, and it’s already usable on the Android L preview for the Nexus 5. While there are currently no third party applications that take advantage of this API, there is a great deal of potential to make camera applications that greatly improve upon OEM camera applications. However, the most critical point to take away is that the new camera API will open up the possibility for applications that no one has thought of yet. While there are still issues with the Android camera ecosystem, with the release of Android L software won’t be one of them.

       Last Google updated its Camera app in May with version 2.2 for devices running Android 4.4+ KitKat OS. The update featured two new Panorama capturing modes, besides the existing horizontal and vertical Panorama modes. The two new Panorama modes are said to be fisheye mode and wide-angle mode. The update also let users the option to click images in 16:9 ratio along with a timer mode with 10 seconds and 3 seconds option.

Android API 20 l preview features

L Preview Features 


     The Android team has been work replacing old code that hasn't scaled well with newer and more powerful hardware. We've long known that the camera API was destined to see a massive update, but we were missing details like a release date or exactly what was coming. Thanks to the L release, we can finally see what has been in the works for all these many months.

 Camera 2 API

     The most important aspects of the new Camera API is a dramatic increase in performance over the previous interface. The Camera 2 system is now capable of delivering full resolution images at the same speed the hardware can capture them thanks to a fully synchronized pipeline model. This allows the Nexus 5 to achieve 30 frames per second while capturing 8 at it's maximum of 8 megapixels.

     In addition to the profound performance improvements, the new camera API also includes burst mode, Digital Negative format (similar to RAW), HDR+, and full manual control of capture and post-processing. Many of the finer control configurations can also be modified, including:
  • Exposure time
  • ISO Sensitivity
  • Frame duration
  • Lens focus distance
  • Flash trigger
  • Color correction matrix
  • JPEG metadata
  • Tonemap curve
  • Crop region
  • AE / AF / AWB mode
  • AE / AWB lock
  • AF trigger
  • Precapture AE trigger
  • Metering regions
  • Exposure compensation
        This new camera API will be officially released in Android L, and it’s already usable on the Android L preview for the Nexus 5. While there are currently no third party applications that take advantage of this API, there is a great deal of potential to make camera applications that greatly improve upon OEM camera applications. However, the most critical point to take away is that the new camera API will open up the possibility for applications that no one has thought of yet. While there are still issues with the Android camera ecosystem, with the release of Android L software won’t be one of them.