Q:

How can we detect custom screen category in android?

I would like to detect custom screen category in android being used in the particular activity,I would like to detect layout-sw640dp programatically,how can be this achieved.We can do the same for small,normal,large & xlarge layouts but I am not sure on this one,kindly help me on this.Thanks.

A:

Not sure why you need to do that. But, a quick walk-around is to use tag, for example:
In mdpi:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@drawable/content_bg"
  android:orientation="vertical"
  android:id="@+id/name"
  android:tag="mdpi-xxx-yyy" >

In hdpi:
  android:id="@+id/name"
  android:tag="hdpi-xxx-yyy" >

Then, read tag from your code for R.id.name.

