Android FileNotFoundException in uploading Photo -


There is a problem finding photos after saving. Here's how I take photos from the camera and save it to the file I am making sense for

  Private zero lephoto (condition of int) {meter meter = adapter.get item (condition); Intentional LifestyleIntent = new intent (mediastore.action_IMUNDCCCT); File StorageDire = Environment.GetEstinestAssistant Directory (Environmental. DIRECTORY_PICTURES); File tempFile = createTempFile (meter.id, JPEG_FILE_SUFFIX, storage DIR); If (tempFile! = Null) {lastPhotoPath = tempFile.getAbsolutePath (); Log D. (Tag, "floating picture path =" + last photopath); Le Picturecentant Input Extra (MediaStore.xtra_utuutut, ure.framefile (tamphfile)); Try {StartActivityForResult (tryPictureIntent, TAKE_PHOTO_REQUEST); Previous photo page = position; } Catch (ActivityNotFoundException exc) {LogE (tag, "Activity not found for photo"); }}}   

Then I want to upload this image to the server later. Here's how I am doing this.

  The public delivers Data OutStorageException (OutputStream Out) {Log D. ("Main menu activity", "not found in file path" + path); InputStream = Faucet; Try {New = BufferedInputStream (New FileInputStream (Path)); // TODO: A Better Way Byte [] buf = New Byte [8192]; Whereas (true) {int length = in.read (buf); If break (length> lt; 0); Out.written (buff, 0, length); }} Catch (FileNote Expansion Act) {New Data Historical Error Experience ("FileNet Foundationexpress, File Required Composer Compose"); } Hold (IOException exc) {// TODO: Probably a network error New DataStoreInternal ErrorExation ("IOException, FileRequestComposer compose"); } Finally {if (in! = Null) {try {in.close (}}} hold (IOException exc) {// FIXME}}}}   

I save the file path I check and check the file path to save both of them equally:

temp image path = / mnt / sdcard / image / 19520 937373434.jpg

not found in the file path / mnt / sdcard / pictures / 19520983731349.jpg

and the exception method is thrown ()

FileNotFoundException, FileRequestComposer compose

Any ideas where I am doing wrong ?

PS and I can not see this file in / mnt / sdcard / pictures mb. Has he lost or is there something like this? Please suggest any suggestion.

P.P.S. Manifest

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Manifest xmlns: Android = "http://schemas.android.com/apk/res/android" package = "com.vodomer" Android: versionCode = "1" Android: versionName = "1.0" & gt; & Lt; Use-sdk android: minSdkVersion = "7" Android: targetSdkVersion = "19" /> & Lt; Use-enabled Android: name = "android.hardware.camera" /> & Lt; Usage-permission Android: name = "android.permission.WRITE_EXTERNAL_STORAGE" /> & Lt; Usage-permission Android: name = "android.permission.INTERNET" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_NETWORK_STATE" /> & Lt; Application Android: label = "@ string / app_name" Android: name = "com.vodomer.DatabaseApplication" & gt; & Lt; Activity Android: name = "vodomer" android: label = "@ string / app_name" android: icon = "@drawable / icon" Android: Theme = "@Android: Style / Theme." Title: Android: Screen Orientation = "Portrait" & Gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; & Lt; Activity Android: name = "Activity.AddressesListActivity" Android: Theme = "@Android: Style / Theme." Title: Android: Screen Orientation = "Portrait" & gt; & Lt; / Activity & gt; & Lt; Activity Android: name = ". Activity.MainMenuActivity" Android: Theme = "@Android: Style / Theme." Title: Android: Screen Orientation = "Portrait" & gt; & Lt; / Activity & gt; & Lt; Activity Android: name = ". Activity.MetersActivity" Android: Theme = "@Android: Style / Theme." Title: Android: Android: WindowSoftwareInputMode = "Adjustment Pin" Android: Screen Orientation = "Portrait" & gt; & Lt; / Activity & gt; & Lt; Activity Android: name = ". Activity.PersonalAccountActivity" Android: Theme = "@Android: Style / Theme." Title: Android: Screen Orientation = "Portrait" & gt; & Lt; / Activity & gt; & Lt; / Application & gt; & Lt; / Reveal & gt;    

The way you create the file due to the problem, instead of trying the regular constructor :

  file tempFile = new file (storage dir, meter.id + jpeg_file_SUFFIX); Normally, you also want to make sure your  storageDir  folder is present and make it if necessary.   

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -