     (doto view
       (.setLayoutParams params))))
 
-(defn set-image-bitmap! [view bytes]
-  (let [bitmap (BitmapFactory/decodeByteArray bytes
-                                              0
-                                              (count bytes))]
-    (on-ui
-        (.setImageBitmap view bitmap))))
-
-(defn image-from-uri [activity uri]
+(defn image-from-url [activity url]
   (let [view (ImageView. activity)]
     (fit-linear-layout! view)
     (let [f (fn [bytes]
-              (set-image-bitmap! view bytes))]
-      (server/get-bytes uri f))
+              (let [bitmap (BitmapFactory/decodeByteArray bytes
+                                                          0
+                                                          (count bytes))]
+                (on-ui
+                    (.setImageBitmap view bitmap))))]
+      (server/get-bytes url f))
     view))
 
 (defn image-from-path [activity path]

        "image" (layout activity (image-from-path activity path))
        "video" (layout activity (video-from-path activity path))))))

(defn swap-view! [activity view]
  (replace-view! activity view))


    (.superOnCreate this bundle)
    (let [on-message (fn [str]
                       (let [instruction (->instruction str)]
                         (log/i "darknet" instruction)
                         (case (:message instruction)
                           "startCameraStream" (do (log/i "startCameraStream " instruction)
                                                   (camera-view this instruction))
                           "streamVideo" (stream-view this instruction)
                           ;; "displayImage" (view-image this instruction)
                           ;; "viewVideo" (view-video this instruction)
                           "save" (save-local! this instruction)
                           "viewRemote" (on-ui (swap-view! this (view-remote this instruction)))
                           "viewLocal" (on-ui (swap-view! this (view-local this instruction)))
                           "stop" (default-view this)
                           :default)))
