我有一个纵向模式的相机应用程序,它从前端和后端相机拍摄照片.我将图像保存在我的SD卡中并尝试找到相应的exif值,它总是给出0.但是我得到了预期的exif方向存储在设备中的其他图像的值(如下载的图片).
我怎样才能解决这个问题 ?谁能帮我吗 ?
这是用于保存图片和查找方向的代码
PictureCallback myPictureCallback_JPG = new PictureCallback() {
@Override
public void onPictureTaken(byte[] arg0, Camera arg1) {
// TODO Auto-generated method stub
try {
File APP_FILE_PATH = new File(Environment.getExternalStorageDirectory()
.getPath() + "/Myapp/");
if (!APP_FILE_PATH.exists()) {
APP_FILE_PATH.mkdirs();
}
File file = new File(APP_FILE_PATH, "image.jpg");
FileOutputStream fos = new FileOutputStream(file);
fos.write(arg0);
fos.close();
imageFileUri=Uri.fromfile(file); getApplicationContext().getContentResolver().notifyChange(
imageFileUri, null);
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://"
+ Environment.getExternalStorageDirectory())));
ExifInterface exif = new ExifInterface(file.getAbsolutePath());
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
} catch (Exception e) {
}
}
};
Run Code Online (Sandbox Code Playgroud)
以下是surphace创建和更改函数的代码 …
我有一个纵向模式的相机应用程序,它从前端和后端相机拍摄照片.问题就像捕获的图像以错误的方式旋转...
对于预览,我使用了以下代码....
Camera.Parameters parameters = camera.getParameters();
android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
android.hardware.Camera.getCameraInfo(defaultCameraId, info);
int rotation = this.getWindowManager().getDefaultDisplay()
.getRotation();
if (Integer.parseInt(Build.VERSION.SDK) >= 8) {
int degrees = 0;
switch (rotation) {
case Surface.ROTATION_0:
degrees = 0;
break;
case Surface.ROTATION_90:
degrees = 90;
break;
case Surface.ROTATION_180:
degrees = 180;
break;
case Surface.ROTATION_270:
degrees = 270;
break;
}
int result;
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
result = (info.orientation + degrees) % 360;
result = (360 - result) % 360; // compensate the mirror …Run Code Online (Sandbox Code Playgroud) 我的应用程序中有一个tableview,我正在加载不同类型的单元格.这很好,运作良好.但现在我需要做分页.我需要将页码作为一,二等传递给服务,并在第一页结束时加载.对于我加载的第一个计数是5,之后当滚动结束时我需要加载下一个.我是这个分页的新手.任何人都可以给我指示方向吗?我试过这样但它会成为一个无限循环`
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *) cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
int count1 = [array count];
NSLog(@"%d",count1);
NSLog(@"%d",indexPath.section);
NSLog(@"%d",max);
NSLog(@"%d",min);
if(indexPath.section == count1 - 1) // If going to display last row available in your source
{
NSLog(@"%d",max);
NSLog(@"%d",min);
if(min <= max)
{
[self getmessages:min];
}
else
{
self.mtableview.tableFooterView = nil; //You can add an activity indicator in tableview's footer in viewDidLoad to show a loading status to user.
}
}
}
Run Code Online (Sandbox Code Playgroud)
`
我有一个自定义的gridview,我正在检查循环方法以查找列表的结尾.如果滚动到达列表的末尾,它将再次向列表中添加一些元素.
gridview.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
}
@Override
public void onScroll(AbsListView arg0, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
int lastInScreen = firstVisibleItem + visibleItemCount;
//is the bottom item visible & not loading more already ? Load more !
if((lastInScreen == totalItemCount) && (!loadingMore))
{
new LoadDataTask().execute();
}
}
});
Run Code Online (Sandbox Code Playgroud)
这是我的异步任务类..
private class LoadDataTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
if (isCancelled()) {
return …Run Code Online (Sandbox Code Playgroud) 当我在我的应用程序中的编辑文本上写东西时,软键盘与底部相对布局一起进来.我想修复底部相对布局位置固定.任何帮助将不胜感激..
我有Iphone应用程序,其中我想使用Non_Renewable订阅.根据文档,MKstorekit支持不可更新订阅.但是到处都只有关于Auto_renewables的说法.任何人都知道如何使用MKstorekit实现不可更新的订阅.我一直在谷歌搜索一整天没有运气.任何人都可以帮助我吗?有人用mkstorekit在应用程序中做过这种吗?
我在使用galaxy nexus测试时在我的相机应用程序中有一个奇怪的问题.当尝试启动相机活动时它只是崩溃.但它几乎所有其他设备都能正常工作..这些是我的功能.....
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
try {
camera = Camera.open();
camera.setPreviewDisplay(holder);
Camera.Parameters parameters = camera.getParameters();
if (Integer.parseInt(Build.VERSION.SDK) >= 8)
setDisplayOrientation(camera, 90);
else
parameters.set("orientation", "portrait");
parameters.setPictureFormat(PixelFormat.JPEG);
camera.setParameters(parameters);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) …Run Code Online (Sandbox Code Playgroud) 我做了检测部分.但是当谈到识别时,当另一个不知名的人来到摄像机前时,它应该显示"未知的人",但它显示的是数据库人的名字.对于所有其他用户,它显示与DB中存储的人员相同的名称.
请帮帮我.
android ×6
camera ×2
iphone ×2
amazon-ebs ×1
amazon-ec2 ×1
amazon-s3 ×1
ios ×1
ipad ×1
nexus-s ×1
objective-c ×1
orientation ×1
uitableview ×1