OSDN Git Service

ライブビューデータを拾うために検討中。その3。
authorMRSa <mrsa@myad.jp>
Fri, 3 May 2019 15:08:03 +0000 (00:08 +0900)
committerMRSa <mrsa@myad.jp>
Fri, 3 May 2019 15:08:03 +0000 (00:08 +0900)
app/src/main/java/net/osdn/gokigen/cameratest/camtest/CamTest.java
app/src/main/res/layout/fragment_main.xml

index cbe97bb..9d344b3 100644 (file)
@@ -262,22 +262,29 @@ public class CamTest implements View.OnClickListener, ILiveViewImage
     {
         try
         {
-            byte[] dummyImageData = new byte[1280 * 1024 + 8];
+            Log.v(TAG, "readImageFileImpl() : " + readFileName);
             final String directoryPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getPath() + "/AirA01a/";
             File filepath = new File(directoryPath.toLowerCase(), readFileName.toLowerCase());
             FileInputStream istr = new FileInputStream(filepath);
-
             final Bitmap imageData = BitmapFactory.decodeStream(istr);
             istr.close();
+            if (imageData == null)
+            {
+                Log.v(TAG, "readImageFileImpl() : bitmap is NULL.");
+            }
+            else
+            {
+                Log.v(TAG, "readImageFileImpl() : bitmap is " + imageData.getByteCount() + " bytes.");
+            }
 
-            //////  画像表示を更新する
+            //////  画像表示を更新する //////
             activity.runOnUiThread(new Runnable() {
                 @Override
                 public void run() {
                     try
                     {
                         // ビットマップイメージを表示する。
-                        ImageView view = activity.findViewById(R.id.imageView);
+                        ImageView view = activity.findViewById(R.id.information_view);
                         view.setImageBitmap(imageData);
                         view.invalidate();
                     }
@@ -288,7 +295,7 @@ public class CamTest implements View.OnClickListener, ILiveViewImage
                 }
             });
         }
-        catch (Exception e)
+        catch (Throwable e)
         {
             e.printStackTrace();
         }
index 4b7ba9e..b87e50e 100644 (file)
@@ -93,7 +93,7 @@
         app:layout_constraintTop_toBottomOf="@id/show_information" />
 
     <ImageView
-        android:id="@+id/information-view"
+        android:id="@+id/information_view"
         android:layout_width="300dp"
         android:layout_height="150dp"
         android:layout_marginBottom="2dp"