The fact is that I have a Video Player using the library and in front of it an ImageView , that is, a banner type that covers 30% of the video player. Every 15 seconds the picture should change.

 mBannerView.setImageBitmap(BitmapFactory.decodeFile(file.getAbsolutePath())); Thread.sleep(1000 * 15); 

But I crash when I change the picture with the message:

Android “Only the original thread that created the view hierarchy can touch its views.”

I tried to write these lines in the UI stream:

 runOnUiThread(new Runnable() { @Override public void run() { ............ } }); 

but then the ImageView doesn’t react to the timer or the change.

I think right now (maybe wrong, in that case, please correct it) that the focus is on the player as the video plays and therefore the picture above it when it changes, crashes.

If so, how to be in that case, how not to lose focus with the ImageView , and the video continued to play? And if not, then what could be wrong?

    1 answer 1

    I'm not quite sure that this is the right option, but if your player is one of the implementations of Android View , try calling the .requestFocus() method on it, it will focus the screen on your player.