In order to check if file is an Image, one can check for the file extension (jpg, png, etc.) using FileFilter as shown below:
- packagecom.livrona.apps.sikh.wallpapers;
- importjava.io.File;
- importjava.io.FileFilter;
- // TODO: Auto-generated Javadoc
- /**
- * The Class CheckImageExtension.
- */
- publicclass CheckImageExtension {
- /** The is valid image. */
- publicstaticFileFilter isValidImage =newFileFilter(){
- @Override
- publicboolean accept(File pathname){
- finalString name = pathname.getName();