1

Android : How to determine the file extension of a file

view story
linux-howto

http://stackoverflow.com – I am trying to share files between two Android phones using Socket programming. The problem is right now I have to hard code the file extension on the receiving end. Is there a way that I can automatically determine the extension of the file being received? Here's my code. Client Side socket = new Socket(IP,4445); File myFile = new File ("/mnt/sdcard/Pictures/A.jpg"); FileInputStream fis = null; fis = new FileInputStream(myFile); OutputStream os = null; os = socket.getOutputStream(); int filesize = (int) myFile.length(); (HowTos)