Every file type associated with its specific icon.
Now if i am choosing somefilename.xxx then how i could be able to choose the icon as
First thing i would like to say any file do not contains it icon with them in general say if you don't have office installed you won't get doc icon or powerpoint icon.
so its system work to associate icon to specific file type so Go this way
To achieve your goal its highly recommended to include all icons that you are expected to use say if You choose some.png check for extention and associate the png.ico to this file icon
doing this way you will have to associate with every type of files.
Edit 1:
you can easily find out the icons on web add to it into your drawable folder's now for every file name extract the extension and set the icon according to the extension this way you can achieve your goal
Edit 2 :
To achieve your goal do the following :
add all icon files to your res\drawable folder for easyness set all
icon file name as its extension Say use doc.png for doc
extension for easyness
Now map all file extension to your icon file say check for file extension and then do something like following:
String ext = "Something";
switch(ext)
{
case "doc":
image.setImageResource(R.drawable.doc);
break;
case "exe":
image.setImageResource(R.drawable.exe);
break;
default :
image.setImageResource(R.drawable.default);
}