Back to project page Phonegap-3-Boilerplate.
The source code is released under:
GNU General Public License
If you think the Android project Phonegap-3-Boilerplate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.rjnpnigrhi.myapp; //from w ww. j a v a2 s . com import org.apache.cordova.DroidGap; import android.content.res.Configuration; import android.os.Bundle; public class StartActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); if (checkScreenSize().equals("large") || checkScreenSize().equals("xlarge")) { initiateApp("tablet"); } else { initiateApp("smartphone"); } } private void initiateApp(String screenSize) { if (screenSize.equals("tablet")) { super.loadUrl("file:///android_asset/www/index.html"); } else { super.loadUrl("file:///android_asset/www/index.html"); } } private String checkScreenSize() { String screenSize; if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) { screenSize = "xlarge"; } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { screenSize = "large"; } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) { screenSize = "normal"; } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) { screenSize = "small"; } else { screenSize = "normal"; } return screenSize; } }