From reading the documentation to support multiple screen sizes, starting with Android 3.2, you can use smallestScreenWidthDpfor conditional typing of the layout, but is there anything for devices with pre-installed 3.2?
I have a fragment based layout and I would like to show both fragments on the screen if the screen size is more than 600dp.
This is the code that I use to install the fragments that I would like to find:
public class MyActivity extends FragmentActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getResources().getConfiguration().smallestScreenWidthDp >= 600) {
finish();
return;
}
if (savedInstanceState == null) {
final DetailFragment details = new DetailFragment();
details.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit();
}
}
}
source
share