실례합니다, 빠른 질문 :Android에서 저장된 이미지는 어디에서 찾을 수 있습니까?
dsocket.receive(packetReceived); // receive packet
byte[] buff = packetReceived.getData(); // convert packet to byte[]
final Bitmap ReceivedImage = BitmapFactory.decodeByteArray(buff, 0, buff.length); // convert byte[] to bitmap image
runOnUiThread(new Runnable()
{
@Override
public void run()
{
// this is executed on the main (UI) thread
imageView.setImageBitmap(ReceivedImage);
}
});
:
내가 패킷을 수신 비디오 스트림,이 루틴을 가지고, 다음, 비트 맵에 다음, [] 바이트 화면에 표시로 변환 이제 녹음 기능을 구현하고 싶습니다. 필자는 FFmpeg (필자는 어떻게 생각하는지 모르겠다)를 사용해야한다고 말했지만, 먼저 주문한 이미지의 디렉토리를 준비하여 비디오 파일로 변환해야한다. 내가 만드는 데 성공 있는지
if(RecordVideo && !PauseRecording) {
saveToInternalStorage(ReceivedImage, ImageNumber);
ImageNumber++;
}
else
{
if(!RecordVideo)
ImageNumber = 0;
}
// ...
private void saveToInternalStorage(Bitmap bitmapImage, int counter){
ContextWrapper cw = new ContextWrapper(getApplicationContext());
// path to /data/data/yourapp/app_data/imageDir
File MyDirectory = cw.getDir("imageDir", Context.MODE_PRIVATE);
// Create imageDir
File MyPath = new File(MyDirectory,"Image" + counter + ".jpg");
FileOutputStream fos = null;
try {
fos = new FileOutputStream(MyPath);
// Use the compress method on the BitMap object to write image to the OutputStream
bitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fos);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
//return MyDirectory.getAbsolutePath();
}
하지만 내 장치 (실제로 디렉토리를 찾을 수 없습니다 : 나는 내부적으로 모든 이미지를 저장합니다, 나는 각 이미지를 저장 this answer를 사용하고 있음을합니까 디렉토리) // path to /data/data/yourapp/app_data/imageDir
은 정확히 어디에 있습니까? 그것은 이미 docs에 따라 존재하지 않는 경우
안녕하세요. 감사합니다. 죄송합니다. 이러한 명령을 사용할 때 멍청한 의견입니다. 코드 내에서 어떻게 실행할 수 있습니까? 그것은 cmd 일 것 같지 않아? 또한, C# 데스크톱 응용 프로그램에서 우리는'C :/.../Desktop' 등의 디렉토리를 선택합니다. 안드로이드에서는 그렇게 할 수 없습니까? –
위의 명령을 사용하여 개인 파일을 sdcard에 복사 한 다음'adb pull'을 사용하고 디렉토리를 지정하여 파일을 컴퓨터로 가져올 수 있습니다. 예를 들어 답을 업데이트하겠습니다. – cascal
끝내 주셔서 감사합니다. 나는 내부 저장소 \ DCIM \ 100MEDIA \ MyDirectoryOfImages와 같은 것을 (또는 상상해보십시오) 경로를 원할 것입니다. 어쩌면 그건 안드로이드가 작동하는 방식이 아닙니다. 나는 아직도 모른다. 학습 :) –