Android examples for User Interface:Screen Resolution
get device Screen Resolution
//package com.java2s; import android.content.Context; import android.content.res.Configuration; import android.widget.Toast; public class Main { public static void deviceScreenResolution(Context context) { int screenSize = context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK; switch (screenSize) { case Configuration.SCREENLAYOUT_SIZE_LARGE: Toast.makeText(context, "Large screen", Toast.LENGTH_LONG) .show();//w ww . j av a 2 s . c o m break; case Configuration.SCREENLAYOUT_SIZE_NORMAL: Toast.makeText(context, "Normal screen", Toast.LENGTH_LONG) .show(); break; case Configuration.SCREENLAYOUT_SIZE_SMALL: Toast.makeText(context, "Small screen", Toast.LENGTH_LONG) .show(); break; default: Toast.makeText(context, "Screen size is neither large, normal or small", Toast.LENGTH_LONG).show(); } } }