在我下面的代码中,我正在尝试使用原生相机拍照并上传到服务器但是当我把它作为肖像并在画廊中查看它作为景观意味着,它旋转到90度.请帮忙: -
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQUEST_CAMERA);
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_CAMERA) {
handleCameraPhoto();
}
private void handleCameraPhoto() {
Intent mediaScanIntent = new Intent(
"android.intent.action.MEDIA_SCANNER_SCAN_FILE");
File f = new File(mCurrentPhotoPath);
Uri contentUri = Uri.fromFile(f);
mediaScanIntent.setData(contentUri);
getActivity().sendBroadcast(mediaScanIntent);
}
Run Code Online (Sandbox Code Playgroud)
如何在保存到SD卡之前旋转图像?
我想要获得1个月前的日期和时间,但我得到的是2013年11 02,正确的应该是2013 12 02 pls帮助.
我的守则如下: -
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -1);
int thisYear = calendar.get(Calendar.YEAR);
int thisMonth = calendar.get(Calendar.MONTH);
int thisDay = calendar.get(Calendar.DAY_OF_MONTH);
Run Code Online (Sandbox Code Playgroud) 我table在我的代码中动态绘制.在tablerow我的布局,我只是在XML硬编码得到的.我不知道为什么我会收到这个错误,完全没有想法.
TableRow tr = (TableRow) findViewById(R.id.tr);
TableRow.LayoutParams rowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
TextView textView1 = new TextView(this);
textView1.setGravity(Gravity.CENTER);
textView1.setBackgroundResource(R.drawable.cell_shape);
textView1.setText("1");
textView1.setLayoutParams(rowParams);
tr.addView(textView1);
TextView textView2 = new TextView(this);
textView2.setGravity(Gravity.CENTER);
textView2.setBackgroundResource(R.drawable.cell_shape);
textView2.setText("2");
textView2.setLayoutParams(rowParams);
tr.addView(textView2);
TextView textView3 = new TextView(this);
textView3.setGravity(Gravity.CENTER);
textView3.setBackgroundResource(R.drawable.cell_shape);
textView3.setText("3");
textView3.setLayoutParams(rowParams);
tr.addView(textView3);
TextView textView4 = new TextView(this);
textView4.setGravity(Gravity.CENTER);
textView4.setBackgroundResource(R.drawable.cell_shape);
textView4.setText("4");
textView4.setLayoutParams(rowParams);
tr.addView(textView4);
TextView textView5 = new TextView(this);
textView5.setGravity(Gravity.CENTER);
textView5.setBackgroundResource(R.drawable.cell_shape);
textView5.setText("5");
textView5.setLayoutParams(rowParams);
tr.addView(textView5);
TextView textView6 = new TextView(this);
textView6.setGravity(Gravity.CENTER);
textView6.setBackgroundResource(R.drawable.cell_shape);
textView6.setText("6");
textView6.setLayoutParams(rowParams);
tr.addView(textView6);
TextView textView7 = (TextView) …Run Code Online (Sandbox Code Playgroud)