Friday, May 19, 2017

Whats new in Android O for developer



From recent I/O 2017 some of the features which Google has brought are to the developers.
  1. Pictures in Pictures
    If you have already declared the  configChanges="true" than you don't have to mention  supportsPictureInPicture="true"
      
  2. Color Management 
    Support for wide-gamut displays
    16-bit PNG, ICC profiles PNG/Webp/JPEG
    color accurate rendering of bitmaps

    New utilities color
  3. Multi-DisplayMulti-display = Multi-Window
    user controlled or app controlled  with ActivityOptions
    Test Configuration Changes
  4. Media ......Continued.....
  5. Kotlin new programming language introduce, quite similar to JAVA, just with optimised syntax.









Monday, May 8, 2017

Sharing the multiple content between two applications

As we all know there are ways to share the content between the applications,
Sending and Receiving the data between two application with intent is most commonly used methodology.

 Method to share text/plain

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);
In the above case user first need to set action to send, using putExtra function one can specify the content which user would like to share with other apps,
using setType function use can set type of content ex: text/plain, image/jpeg,

Share multiple pieces of content 

To share multiple pieces of data, android has given inbuilt function parcelableArraylist wherein user can form list uri and put into parcelableArraylist and can start intent to share data over other apps
ArrayList<Uri> imageUris = new ArrayList<Uri>();
imageUris.add(imageUri1); // Add your image URIs here
imageUris.add(imageUri2);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "Share images to.."));

Sample code: