createBitmap(view. As this article uploads the image/video taken from camera, you need to have knowledge over android camera module. From here, we can create a jpeg and save it to the Media Library of the device. I've discovered there's an enum Android. Zooming in on a bitmap image in any graphics program allows the user to add, delete, or change the color of individual pixels. Image Management in Online Services — Resources about image APIs used for image management and operations in social media and other online services, such as Twitter, Instagram, Facebook, and more. How to CORRECTLY take a screenshot using Android MediaProjection API With the MediaProjection API in Android 5. It needs a context, better to use the pass in the application context by getApplicationContext(). Then once you get the bitmap object, you can now iterate through all of the pixels. It will also tell you how to display those pictures one by one when user click one picture. YES, WITHOUT SAVING THEM TO EXTERNAL MEMORY. decodeStream: 39. 5MB (800*480*4 bytes), so this would cache a minimum of around 2. Compress? This site uses cookies for analytics, personalized content and ads. This is how you can easily use an ActionBar share icon to activate a ShareIntent. Reading images from android device gallery. You can vote up the examples you like and your votes will be used in our system to generate more good examples. Get Texture From Bitmap Resource and BitmapFactory. js, JQuery and more. Android File I/O and Supported Image Formats. Though it may seem easy to set an image as a wallpaper, there are various small issues that need to be addressed to correctly set a wallpaper. Drawable to Bitmap: 40. Bitmap downloading, processing: 47. The application will detect the number of faces in the image and draws a rectangle around each face in the image. Add internet permission. What is the difference between bitmap and vector images? » Images » Windows » Tech Ease: Bitmap (or raster) images are stored as a series of tiny dots called pixels. Because bitmap images are built pixel-by-pixel, they can be easily edited. I saved the images in the drawable folder by copy and paste. In this tutorial, you will create a simple Android application that uses the Azure Face API, through the Java SDK, to detect human faces in an image. * A copy of the Android internals StoreThumbnail method, it used with the insertImage to * populate the android. I'm trying to implement camera preview image data processing using camera2 api as proposed here: Camera preview image data processing with Android L and Camera2 API. Zooming in on a bitmap image in any graphics program allows the user to add, delete, or change the color of individual pixels. If the user has a picasa account and if you try to pick the photo from picasa albums (which also shows up in gallery), it throws a null pointer exception in im. Firebase is a mobile and web application development platform, and Firebase Storage provides secure file uploads and downloads for Firebase apps. I'm having some issue with saving taken picture from camera to local storage. YES, WITHOUT SAVING THEM TO EXTERNAL MEMORY. ImageReader. This method returns your device internal memory and images save visible to every app. Image Compression without affecting Image quality in Android Hello Friends, Today i am going to brief you about how you can upload large size image in compressed form like whatsapp. In this tutorial, we didn't go in deep about dpi and various screen issue, we just use ImageView to display. decodeFile: 33. Android Face Detection Example In this sample application we will detect the faces in the given photograph. I am new to the world of Android and have been working on the same problem. Photoshop Elements enables you to convert images to bitmap mode, commonly used in printing line art, such as black-and-white logos, illustrations, or black-and-white effects that you create from your RGB images. If the source bitmap is immutable and the requested subset is the same as the source bitmap itself, then the source bitmap is returned and no new bitmap is created. So the get is to retrive the bytes from the image buffer. A Drawable that wraps a bitmap and can be drawn with rounded corners. captures given view and converts it to a bitmap: 32. ) and then you can use the code in above posts to save that image to a particular location on your device. The first Image View sets the image on a button click and the others contain the images to be set. The MainActivity captures images from the camera and displays them as thumbnail images inside of a dynamic GridView. Create an image view, given a drawable. Apparantely, this code works if you try to pick the photos from camera. A NinePatchDrawable graphic is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background. Then once you get the bitmap object, you can now iterate through all of the pixels. Create an image view, given a drawable. You can easily apply image processing techniques to add certain kinds of effects on images. The idea is to display the image at an appropriate size for the device. A Drawable resource is a general concept for a graphic which can be drawn. Does our tutorials help you then help as spread the word, like and share. Firebase Setup. ShareActionProvider. This method will help us to retrieve drawable resource image and decode it into bitmap format. You can vote up the examples you like and your votes will be used in our system to generate more good examples. This is how you can easily use an ActionBar share icon to activate a ShareIntent. These examples are extracted from open source projects. If the user has a picasa account and if you try to pick the photo from picasa albums (which also shows up in gallery), it throws a null pointer exception in im. Example 1 Project: CVPR2015-master File: Camera2BasicFragment. It needs a context, better to use the pass in the application context by getApplicationContext(). A key to making your PNG files smaller is reducing the number of unique colors used in each row of pixels that comprises the image. The Bitmap generator class is found on github source for the book. Also see the Bitmap class, which handles the management and transformation of raw bitmap graphics, and should be used when drawing to a Canvas. Android apps typically use images that are in one or more of the following file formats: PNG, JPG, and WebP. It loads the image in memory from the buffer to the bytes array. xml: [code ] files which is used to create a bitmap array of reduced pixels using the function getBitmap we created in the first step. thank you so much for this ! it really helped me alot !!! but can i ask you question please. Android Face Detection Example In this sample application we will detect the faces in the given photograph. In this tutorial, I will get an image from drawable folder, then save it to directory in sdcard and update into gallery. Get Code The code is now on github you can get it from here. Add one TextView, one ImageView, One EditText and two Buttons in activity_main. Categories Android. the path of the picasa album is different from the path of camera (local) pictures. How to dynamically display image from android mobile phone gallery and Google photos & set into app on button click. A single complete image buffer to use with a media source such as a MediaCodec or a CameraDevice. ShareActionProvider. Basically, I want to save a specific frame of a video from my phone Library. This is how you can easily use an ActionBar share icon to activate a ShareIntent. From here, we can create a jpeg and save it to the Media Library of the device. Generate a blurred bitmap from given one: 34. Firebase storage provides facility to upload any file like image, video, audio, etc without using server side code. So the get is to retrive the bytes from the image buffer. Sometimes in your Android application you'll want the user to choose an image from the gallery that'll be displayed by the application (and even uploaded to your servers) after the selection is made. Image Compression without affecting Image quality in Android Hello Friends, Today i am going to brief you about how you can upload large size image in compressed form like whatsapp. How to Upload, Cache, Save and Share image in an Android App? アンドロイドアプリでイメージをアップロードやキャッシュ、保存やシェアをする方法とは?¿Cómo subir, cachear, guardar y compartir una imagen en una aplicación de Android?Bagaimana Cara Meng-Upload, Cache, Simpan dan Bagikan Gambar di App Android?. In this tutorial, you will create a simple Android application that uses the Azure Face API, through the Java SDK, to detect human faces in an image. Categories Android. ShareActionProvider. If you don't have a Firebase account yet, you can create one at the Firebase. Create, configure and connect Firebase project to your Android Studio Application. So we need to get the uri represent file real local path, then we can read it and save a copy to our app folder. Example 1 Project: CVPR2015-master File: Camera2BasicFragment. You can clear the cached images once the bitmap is utilized. Android Upload Image to Firebase Storage Tutorial In this tutorial you will learn to upload image to firebase storage in android. Drawing a Bitmap onto a Bitmap Last Updated on Wed, 06 Apr 2016 | Android Media Before we get into the specific mechanisms used to alter the images, let's look at how we can create a new, empty Bitmap object and draw an existing Bitmap into that. You can get the pixel from the view like this: > bitmap = ((BitmapDrawable)imageView. Android Upload Image to Server Using Volley Server Code. These source code samples are taken from different open source projects. if i want to save the selected picture into my database or drawable file. From here, we can create a jpeg and save it to the Media Library of the device. Get Bitmap From Bytes: 29. Similarly. insertImage. UPDATE (October 19, 2009): In order to be bale to view thumbnails images from the SD Card, Android needs to create them first, hence you should start the Gallery application that comes preinstalled, and open the sdcard folder which will automatically create thumbnails for the images stored on your sdcard. RGB_565); Next create a canvas with the bitmap and pass that into the draw() method of the view. However for creating image from view in android first convert the view to bitmap format. From here, we can create a jpeg and save it to the Media Library of the device. Even so “Share An Image Without Saving it in Android” is explained above you can still download it from here, You can modify the code us u like. getDrawable()). On a normal/hdpi device this is a minimum of around 4MB (32/8). In Android, you can use "android. In Part III we will look on how to let the user pick an image from the Android Gallery and display it in your application. Through a simple app - Walltoday which allows a user to set a wallpaper for each day which changes automatically every morning, this tip shows a number of points which will help in setting the wallpaper. Hi Sir I have Problem is that if i change image on firebase through direct or other one upload his new image then when i load this image than its show old image and get from catch memory so please tell me how to notify to catch if i change image on firebase is it because of replace image ?. In this post, I will be discussing about how to upload an Image present in Gallery App to PHP server. Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2. Compress? This site uses cookies for analytics, personalized content and ads. A single complete image buffer to use with a media source such as a MediaCodec or a CameraDevice. When clicking on the Pick Image button, the Android media gallery will open allowing you to browse for a photo, select it, and finally display it in the application. 5MB (800*480*4 bytes), so this would cache a minimum of around 2. For each of these formats, there are steps you can take to reduce image sizes. To recognize text in an image using either an on-device or cloud-based model, run the text recognizer as described below. This requires loading the data into a memoryStream, creating a bitmap image with the memory stream as its source, and finally instantiating a new WriteableBitmap using the bitmapImage in the constructor. A Drawable resource is a general concept for a graphic which can be drawn. RGB_565); Next create a canvas with the bitmap and pass that into the draw() method of the view. Drawable to Bitmap: 40. 5 pages of images in memory. Contents in this project Android Capture Image From Camera Upload to Server Using PHP MySQL :-Create Database including table on your server. Saving a Bitmap Based Canvas Drawing Last Updated on Mon, 30 Jul 2012 | Android Media What good would it be to just draw on an image without being able to save it after the user has created a masterpiece?. Compress Bitmap: 30. Reading images from android device gallery. Cloud Storage allows developers to quickly and easily upload files to a Google Cloud Storage bucket provided and managed by Firebase. Note: By default, Cloud Storage buckets require Firebase Authentication to upload files. Back to Development/activity ↑ From Project. In this tutorial, I will get an image from drawable folder, then save it to directory in sdcard and update into gallery. So we need to get the uri represent file real local path, then we can read it and save a copy to our app folder. No point exists in showing a 10-foot mural in a 6-inch frame. Drawing a Bitmap onto a Bitmap Last Updated on Wed, 06 Apr 2016 | Android Media Before we get into the specific mechanisms used to alter the images, let's look at how we can create a new, empty Bitmap object and draw an existing Bitmap into that. While learning Android, most of the developers find it difficult to upload an Image to Server from Android App using PHP Webservice as server-side. To get the bitmap from the calling activity we will be passing the bitmap’s Uri to the custom image view and then loading it from there. Android Open Source - MediaProjectionDemo Screen Capture Image Activity. It is possible to use image or icon or bitmap as Google Maps Marker Icon, even you can customize it by creating a layout for the custom marker. Run the text recognizer To recognize text in an image, create a FirebaseVisionImage object from either a Bitmap, media. Does our tutorials help you then help as spread the word, like and share. Usually image processing operations will be done in native C/C++ languages. Image Compression without affecting Image quality in Android Hello Friends, Today i am going to brief you about how you can upload large size image in compressed form like whatsapp. Bitmap image type is also a image extension mostly used in android applications to create and store drawable images inside android projects. This class allows for efficient direct application access to the pixel data of the Image through one or more ByteBuffers. A key to making your PNG files smaller is reducing the number of unique colors used in each row of pixels that comprises the image. I can't say that this is the best way, but it is one way I found that worked. 我使用onImageAvailableListener成功接收回调,但是为了将来的处理,我需要从YUV_420_888 android. The image is then converted into Base64 string format and sent to server using volley network library. Save Bitmap to External Storage Directory: 45. This requires loading the data into a memoryStream, creating a bitmap image with the memory stream as its source, and finally instantiating a new WriteableBitmap using the bitmapImage in the constructor. Compress? This site uses cookies for analytics, personalized content and ads. Media#insertImage with all the correct * meta data. getDrawable()). Drawable to Bitmap: 40. Before downloading the image, let’s write a method for saving bitmap into an image file in the internal storage in android. As a example, the bitmap is retrieved from ImageView by calling ((BitmapDrawable)imageView. getWidth(), view. From here, we can create a jpeg and save it to the Media Library of the device. Cloud Storage allows developers to quickly and easily upload files to a Google Cloud Storage bucket provided and managed by Firebase. Images and media can play an important role in creating an exceptional Android app. I can't say that this is the best way, but it is one way I found that worked. The idea is to display the image at an appropriate size for the device. Get Image Bitmap From Url: 42. getPixel(x,y); Here pixel is just an integer. Had exactly this problem to solve, and this post has saved a lot of digging to get it working. Get Bitmap. */ Bitmap bitmap=BitmapFactory. download images from the Internet and binds those with the provided ImageView. If you convert a vector to a bitmap 100 by 100 pixels and then decide you need the image to be larger, you'll need to go back to the original vector file and export the image again. The first Image View sets the image on a button click and the others contain the images to be set. In this tutorial we are simply converting the bitmap image to drawable. The new bitmap may be the same object as source, or a copy may have been made. Image file is easy to use but hard to master, because of the various screen and dpi in Android devices. Prerequisite. */ Bitmap bitmap=BitmapFactory. Even so “Share An Image Without Saving it in Android” is explained above you can still download it from here, You can modify the code us u like. So here is the complete step by step tutorial for Android Capture Image From Camera Upload to Server Using PHP MySQL. Step 3: Create a union bitmap of the two images of particular width and height and then draw your bitmaps into a canvas using the Android Canvas class:. Firebase storage provides facility to upload any file like image, video, audio, etc without using server side code. Then once you get the bitmap object, you can now iterate through all of the pixels. Image, which are recommended when possible. It needs a context, better to use the pass in the application context by getApplicationContext(). First create a new project with main. This Tutorial discusses a quick, simple approach to capture image from camera and select image from gallery. So the get is to retrive the bytes from the image buffer. bitmap Factory class is used to create the object from various resources including files, streams and byteArrays. Android - ImageView crop (mask) image as par background shape Here is sample code to crop image as par background shape. This content can then be stored within the application programming code as a Bitmap object for further processing or display. Tutorial: Create an Android app to detect and frame faces in an image. If the user has a picasa account and if you try to pick the photo from picasa albums (which also shows up in gallery), it throws a null pointer exception in im. captures given view and converts it to a bitmap: 32. BitmapFactory) class. Android Upload Image to Server Using Volley Server Code. The effects could be brightness,darkness, grayscale conversion e. However, it needs to be in a Mat first. By continuing to browse this site, you agree to this use. Greenhorn How to set the bitmap height at runtime how to upload image from android to restful webservice using jersey. This method will help us to retrieve drawable resource image and decode it into bitmap format. Deleting Cached Images: While the image are taken with camera, they will stored in cached directory. Image file is easy to use but hard to master in Android, because of the various screen sizes in Android devices. the path of the picasa album is different from the path of camera (local) pictures. Drawable to Bitmap: 40. Zooming in on a bitmap image in any graphics program allows the user to add, delete, or change the color of individual pixels. Bitmap image = Bitmap. In Android, you can use "android. Hi, Just like the title says, how can I convert Bitmap object to byte[] without the use of Bitmap. createBitmap(view. UPDATE (October 19, 2009): In order to be bale to view thumbnails images from the SD Card, Android needs to create them first, hence you should start the Gallery application that comes preinstalled, and open the sdcard folder which will automatically create thumbnails for the images stored on your sdcard. In this example, two activities are used, a MainActivity and ImageDisplayActivity. How to convert and show bitmap image to drawable inside ImageView on button click. I can't say that this is the best way, but it is one way I found that worked. The EffectFactory class defines the list of available Effects, and provides functionality to inspect and instantiate them. Run the text recognizer To recognize text in an image, create a FirebaseVisionImage object from either a Bitmap, media. 4 and less is about 20% and decreasing, it's not possible to save to SD card using File class and getExternalStorageDirectory() method. Reading images from android device gallery. So we need to get the uri represent file real local path, then we can read it and save a copy to our app folder. In fact, I just wrote up something and put it on my blog page. Have a nice day. xml as shown below: Open MainActivity. A Drawable that wraps a bitmap and can be drawn with rounded corners. The source code is released under: Do whatever you want License. How to CORRECTLY take a screenshot using Android MediaProjection API With the MediaProjection API in Android 5. setImageBitmap(image); because your filepath is null. The first Image View sets the image on a button click and the others contain the images to be set. Hi Guys, thanks for the help with this one. Hi, Just like the title says, how can I convert Bitmap object to byte[] without the use of Bitmap. ) and then you can use the code in above posts to save that image to a particular location on your device. So here is the complete step by step tutorial for Convert Bitmap image to Byte Array in android example. Best Java code snippets using android. Note: By default, Cloud Storage buckets require Firebase Authentication to upload files. Compress and save Bitmap image: 46. Step 1 First I used many Image Views and ScrollViews for the sliding activity. Media#insertImage with all the correct * meta data. js, JQuery and more. “Android Notes 72: How to convert Bitmap to Uri?” is published by Kuray Ogun in FreakyCoder Software Blog. Glide abstracts out most of the complexity in handling these and other tasks related to working with bitmaps and other images on Android. So the get is to retrive the bytes from the image buffer. Cloud Storage allows developers to quickly and easily upload files to a Google Cloud Storage bucket provided and managed by Firebase. There is no point in showing a 10-foot mural in a 6-inch frame. 4 and less is about 20% and decreasing, it's not possible to save to SD card using File class and getExternalStorageDirectory() method. xml as shown below: Open MainActivity. Save Bitmap to and load from External Storage: 41. Our camera is already set up to preview android. Get Bitmap From Local Path: 28. 5 pages of images in memory. After done everything all you have to do it click on OK button and it will show the cropped image inside ImageView. 0 it is possible to: capture the contents of the main screen (the default display) into a Surface object, which your app can then send across the network. In like manner feel free to comment your doubt’s below. Image Upload in Web Apps — Resources about uploading images in web applications using languages and frameworks like PHP, Angular. Images and media can play an important role in creating an exceptional Android app. Image object and the image's rotation to. Save Image in Folder in Android by Nithya Govind 26/06/2014 | 6:35 0 Posted in Android In this blog post, I would like to explain how to create an folder inside the gallery folder, and save an image within that folder in Android. Android Layout View to Bitmap and Bitmap to Image Save. Zooming in on a bitmap image in any graphics program allows the user to add, delete, or change the color of individual pixels. Back to project page MediaProjectionDemo. No point exists in showing a 10-foot mural in a 6-inch frame. The MainActivity captures images from the camera and displays them as thumbnail images inside of a dynamic GridView. In this tutorial we are simply converting the bitmap image to drawable. The following are top voted examples for showing how to use android. In Android, ImageView class is used to display an image file in application. getBitmap();int pixel = bitmap. From the latest version of Android, Nougat — Capturing an image through a default camera is exposing a FileUriExposedException. Image so we simply pass that along with the camera orientation: An important thing to note is that the Image returned has a width and height equivalent to the specified dimensions specified for the camera. Android provides Bitmap class to handle images. Get image frame in video using MediaMetadataRetriever MediaMetadataRetriever, for API level 10 or higher, provides a unified interface for retrieving frame and meta data from an input media file. To recognize text in an image using either an on-device or cloud-based model, run the text recognizer as described below. Media", to show how to insert bitmap to MediaStore with title, and list images title in MediaStore. getBitmap(), note that it's not always work, depends on how to load image to ImageVIew. Before downloading the image, let’s write a method for saving bitmap into an image file in the internal storage in android. After done everything all you have to do it click on OK button and it will show the cropped image inside ImageView. You can get the pixel from the view like this: > bitmap = ((BitmapDrawable)imageView. Each pixel is actually a very small square that is assigned a color, and then arranged in a pattern to form the image. Because bitmap images are built pixel-by-pixel, they can be easily edited. Hi there, How to convert Bitmap to an Image? I want to display the returned bitmap in an Image only not on the webpage. How to Create Bitmap Objects of an Image File on Android. Note: By default, Cloud Storage buckets require Firebase Authentication to upload files. So here is the complete step by step tutorial for Add/Set bitmap in imageview in android programmatically. However for creating image from view in android first convert the view to bitmap format. For most cases, we recommend that you use the Glide library to fetch, decode, and display bitmaps in your app. How to dynamically display image from android mobile phone gallery and Google photos & set into app on button click. xml layout file. Get Bitmap From Bytes: 29. You'll need two drawable, one for background and one for masking. In Android, ImageView class is used to display an image file in application. getWidth(), view. Hi, Just like the title says, how can I convert Bitmap object to byte[] without the use of Bitmap. drawable: This package provides classes to manage a variety of visual elements that are intended for display only, such as bitmaps and gradients. So here is the complete step by step tutorial for Convert Bitmap image to Byte Array in android example. Get Image Bitmap From Url: 42. It needs a context, better to use the pass in the application context by getApplicationContext(). The image labeler runs fastest when you use a Bitmap or, if you use the camera2 API, a JPEG-formatted media. Here is one possible approach: Launch Android Studio and create a new project. Sometimes you do nothing wrong in Android Code but Image doesn’t upload to the server. getDrawable()). The following are top voted examples for showing how to use android. Android File I/O and Supported Image Formats. Because from android KitKat ( sdk version 19 ), the system returned uri is not real local file path uri, it is a content provider style uri, so we should parse the uri and get the real file local path by query related content provider ( image provider, audio provider, video provider. The idea is to display the image at an appropriate size for the device. For a ground overlay, it can be used to set the image to place on the surface of the earth. It will also tell you how to display those pictures one by one when user click one picture. Have a nice day. Compress? This site uses cookies for analytics, personalized content and ads. BitmapFactory) class. Prerequisite. You can clear the cached images once the bitmap is utilized. This blog shows an example of capturing, handling, displaying, and sharing images in an Android app. Generate a blurred bitmap from given one: 34. Similarly. In this tutorial, I will get an image from drawable folder, then save it to directory in sdcard and update into gallery. The image labeler runs fastest when you use a Bitmap or, if you use the camera2 API, a JPEG-formatted media. Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2. 4 Kitkat, and as of 2017 share of Android 4. ShareActionProvider. A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon. So here is the complete step by step tutorial for Android Image Cropping Example Tutorial Pick Gallery Camera Image. Android apps typically use images that are in one or more of the following file formats: PNG, JPG, and WebP. Firebase is a mobile and web application development platform, and Firebase Storage provides secure file uploads and downloads for Firebase apps. Sometimes in your Android application you'll want the user to choose an image from the gallery that'll be displayed by the application (and even uploaded to your servers) after the selection is made. Android Upload Image to Server Using Volley Server Code. The simplest case is a graphical file (bitmap), which would be represented in Android via a BitmapDrawable class. How do I convert the data to Mat, and how do I convert it back to Bitmap when. xml layout file. So I recommend you go through my previous tutorial Android Working with Camera which gives you an overview of integrating camera in your android apps. This can be found under android. @Melani - It doesn't matter where the image is coming from. Get Code The code is now on github you can get it from here. There is no point in showing a 10-foot mural in a 6-inch frame. getBitmap();int pixel = bitmap. Cloud Storage allows developers to quickly and easily upload files to a Google Cloud Storage bucket provided and managed by Firebase. This article will show you an example about how to use intent to invoke android camera programmatically to take and save pictures. How to dynamically display image from android mobile phone gallery and Google photos & set into app on button click. If you do not provide bitmaps for all supported resolutions, the Android system scales the closest fit up or. It is possible to use image or icon or bitmap as Google Maps Marker Icon, even you can customize it by creating a layout for the custom marker. How to convert and show bitmap image to drawable inside ImageView on button click. The following are top voted examples for showing how to use android. While learning Android, most of the developers find it difficult to upload an Image to Server from Android App using PHP Webservice as server-side. In this article, you will learn how to set an image in an Image View on a click. Include reusable_layout in your project's activity_main. The source code is released under: Do whatever you want License. This method can be dumped into your Activity class or other util classes. Add one TextView, one ImageView, One EditText and two Buttons in activity_main. When loading a bitmap into an ImageView, the LruCache is checked first. Save Bitmap and BitmapFactory. Save Bitmap to External Storage Directory: 45. RGB_565); Next create a canvas with the bitmap and pass that into the draw() method of the view. An example use of a NinePatch is the backgrounds used by standard Android buttons — buttons must stretch to accommodate strings of various lengths. thank you so much for this ! it really helped me alot !!! but can i ask you question please.