Junaid
Junaid

Reputation: 7860

Target different screen sizes for VideoView

I am developing a splash screen in my application, which includes a VideoView with attributes of fill_parent in either dimension. Now as I know that graphics are rendered differently from different folders at runtime and that this holds true for only images. I have devised the following code to run based on screen configuration:

      Display mDisplay = getWindowManager().getDefaultDisplay(); 
      int w = mDisplay.getWidth();
      int h = mDisplay.getHeight();

      if (w < 480 || h < 800) {
         mVideoView.setVideoPath(...your video in assets, of low resolution...);;
      } else {
         mVideoView.setVideoPath(...your video in assets, of high resolution...);
      }
     ... 

(Reference: VideoView in different screen sizes)

Now I want to know which screen sizes are most common and which screen sizes should I support, I want my application to be compatible with most of the devices.

Upvotes: 1

Views: 393

Answers (1)

Shadow
Shadow

Reputation: 6899

Have you tried this?

Use in res/values-xlarge/ with Boolean value

<bool name="isTabletDevice">true</bool>

In res/values use

<bool name="isTabletDevice">false</bool>

boolean tabletDeviceSize = getResources().getBoolean(R.bool.isTabletDevice);

if (tabletDeviceSize) {

//use tablet support videoview 

} else

{

//use mobile support videoview 

}

As per android supporting screen

http://developer.android.com/guide/practices/screens_support.html,

res/values-sw600dp can also be used.

(for 600dp wide tablet and bigger).

Upvotes: 2

Related Questions