您好我正在尝试保存在我的应用程序上拍摄的照片,但是当我尝试访问内存以放置数据时,会出现错误
无法解码流java.io.FileNotFoundException/storage/emulated/0 open failed:ENOENT(没有这样的文件或目录)
这是我的代码.
Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
// TODO Auto-generated method stub
if (data != null){
//Intent mIntent = new Intent();
//mIntent.putExtra("image",imageData);
mCamera.stopPreview();
mPreviewRunning = false;
mCamera.release();
try{
BitmapFactory.Options opts = new BitmapFactory.Options();
Bitmap bitmap= BitmapFactory.decodeByteArray(data, 0, data.length,opts);
bitmap = Bitmap.createScaledBitmap(bitmap, 300, 300, false);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int newWidth = 300;
int newHeight = 300;
// calculate the scale - in this case = …Run Code Online (Sandbox Code Playgroud) 我正在尝试从我的数据库在线获取图片,在我的"imagelink"中,这是我表中的数据字段,我把那些我上传的图片的网址放在那里,但不幸的是它给了我这个错误.
02-08 15:05:29.432 14364-14364/com.example.jithea.testlogin E/BitmapFactory? Unable to decode stream: java.io.FileNotFoundException: /http:/agustiniancampusevents.site40.net/newsDB/images/Visual%20Report%20Filipino%20Final-12%20copy.JPG: open failed: ENOENT (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
这是我在onPostExecute中的代码:
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
NewsActivity.this, productsList,
R.layout.news_list_item, new String[]{TAG_PID, TAG_IMAGELINK,
TAG_NEWSTITLE, TAG_DESCRIPTION},
new int[]{R.id.pid, R.id.imageView, R.id.newstitle, R.id.description});
// updating listview
setListAdapter(adapter);
} …Run Code Online (Sandbox Code Playgroud)