Android Context Get getSizeName(Context context)

Here you can find the source of getSizeName(Context context)

Description

get Size Name

License

Open Source License

Declaration

static String getSizeName(Context context) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.content.res.Configuration;

public class Main {
    static String getSizeName(Context context) {
        int screenLayout = context.getResources().getConfiguration().screenLayout;
        screenLayout &= Configuration.SCREENLAYOUT_SIZE_MASK;

        switch (screenLayout) {
        case Configuration.SCREENLAYOUT_SIZE_SMALL:
            return "small";
        case Configuration.SCREENLAYOUT_SIZE_NORMAL:
            return "normal";
        case Configuration.SCREENLAYOUT_SIZE_LARGE:
            return "large";
        case 4: // Configuration.SCREENLAYOUT_SIZE_XLARGE is API >= 9
            return "xlarge";
        default:// w  w  w .  j  av  a 2s.  c  om
            return "undefined";
        }
    }
}

Related

  1. getScenario(Context context, String filename, int widgetid, int defaultScenario)
  2. getSeed(Context context)
  3. getSelectedLangCodes(Context context, int[] indexes, boolean[] selectedItems, int codeResourceId)
  4. getServiceMetaData(Context context, Class serviceClass, String key)
  5. getSignatures(final Context context)
  6. getSmiledText(Context context, CharSequence text)
  7. getSmsId(Context context)
  8. getString(Context context, String key, String defValue)
  9. getString(Context context, int resourceId)