Check Android device for available video capabilites?

Is there any easy way to check if an Android device can play a 1280 x 720 px MP4 H.264 Video, so that an app could gracefully fall back on a lower resolution version like 360 x 480 px or disable the video functionality? (The videos are embedded in the app, as they aren't very long.)

Answers


You can get the physical resolution of the device using the following snippet:

WindowManager w = getWindowManager();
Display d = w.getDefaultDisplay();
int width = d.getWidth();
int height = d.getHeight(); 

EDIT:

Just checked the API. The getWidth() and getHeight() methods are deprecated now. You will have to use getSize() instead.


Need Your Help

Entity framework, code first : Avoid unwanted connections to the azure master database

c# database entity-framework azure azure-sql-database

When EF tries to connect to Azure sql database (perhaps when trying to open a connection to the database, not sure) it attempts to connect/login to the master database, the question is why?

Output for creating a 2d array of characters doesot come as expected

java arrays

Given a para of words (separated by space), create a 2D array where each array in it represents the word. Note that the words are of the same size.