¡@

Home 

2014/10/16 ¤W¤È 08:09:48

android Programming Glossary: android.os.build.version.sdk_int

READ_LOGS permission on Jelly Bean (api 16)

http://stackoverflow.com/questions/11461650/read-logs-permission-on-jelly-bean-api-16

0 Log.d TAG we do not have the READ_LOGS permission if android.os.Build.VERSION.SDK_INT 16 Log.d TAG Working around JellyBeans 'feature'... try format..

How to justify text on a TextView made easy- Android

http://stackoverflow.com/questions/11922861/how-to-justify-text-on-a-textview-made-easy-android

expected. Need to use software renderer in that case. if android.os.Build.VERSION.SDK_INT 11 this.setLayerType WebView.LAYER_TYPE_SOFTWARE null public..

setBackground vs setBackgroundDrawable (Android)

http://stackoverflow.com/questions/11947603/setbackground-vs-setbackgrounddrawable-android

of it... You'd do something like following int sdk android.os.Build.VERSION.SDK_INT if sdk android.os.Build.VERSION_CODES.JELLY_BEAN setBackgroundDrawable..

Caused by: android.os.NetworkOnMainThreadException [duplicate]

http://stackoverflow.com/questions/13136539/caused-by-android-os-networkonmainthreadexception

file after setContentView R.layout.activity_main if android.os.Build.VERSION.SDK_INT 9 StrictMode.ThreadPolicy policy new StrictMode.ThreadPolicy.Builder..

Android 4.2 broke my encrypt/decrypt code and the provided solutions don't work

http://stackoverflow.com/questions/13433529/android-4-2-broke-my-encrypt-decrypt-code-and-the-provided-solutions-dont-work

4.2 and the provided solution SecureRandom sr null if android.os.Build.VERSION.SDK_INT JELLY_BEAN_4_2 sr SecureRandom.getInstance SHA1PRNG Crypto else..

Use Roboto font in app with minimum API level 14

http://stackoverflow.com/questions/14631326/use-roboto-font-in-app-with-minimum-api-level-14

in your Layout. You just have to do this use this then if android.os.Build.VERSION.SDK_INT 11 TextView txt TextView findViewById R.id.myTxtView else TextView_Roboto..

Playing HTML5 video on fullscreen in android webview

http://stackoverflow.com/questions/15768837/playing-html5-video-on-fullscreen-in-android-webview

getWindow .setAttributes attrs if android.os.Build.VERSION.SDK_INT 14 getWindow .getDecorView .setSystemUiVisibility View.SYSTEM_UI_FLAG_LOW_PROFILE.. getWindow .setAttributes attrs if android.os.Build.VERSION.SDK_INT 14 getWindow .getDecorView .setSystemUiVisibility View.SYSTEM_UI_FLAG_VISIBLE..

Retrieving Android API version programmatically

http://stackoverflow.com/questions/3423754/retrieving-android-api-version-programmatically

the SDK level integer the phone is running is available in android.os.Build.VERSION.SDK_INT The enum corresponding to this int is in the android.os.Build.VERSION_CODES.. class. Code example int currentapiVersion android.os.Build.VERSION.SDK_INT if currentapiVersion android.os.Build.VERSION_CODES.FROYO Do..

Get android api level of phone currently running my application [duplicate]

http://stackoverflow.com/questions/3993924/get-android-api-level-of-phone-currently-running-my-application

of getting the API level would be to check the value of android.os.Build.VERSION.SDK_INT which is an integer. In either case the integer you get maps..

How do you use Intent.FLAG_ACTIVITY_CLEAR_TOP to clear the Activity Stack?

http://stackoverflow.com/questions/4342761/how-do-you-use-intent-flag-activity-clear-top-to-clear-the-activity-stack

public boolean onKeyDown int keyCode KeyEvent event if android.os.Build.VERSION.SDK_INT android.os.Build.VERSION_CODES.ECLAIR keyCode KeyEvent.KEYCODE_BACK..

Strategies for Honeycomb & backward compatibility

http://stackoverflow.com/questions/4832262/strategies-for-honeycomb-backward-compatibility

available. private static boolean shinyNewAPIsSupported android.os.Build.VERSION.SDK_INT 10 private static boolean fragmentsSupported false private static..

VerifyError deploying on API 1.6

http://stackoverflow.com/questions/6495007/verifyerror-deploying-on-api-1-6

1.6. Im getting a VerifyError on this piece of code if android.os.Build.VERSION.SDK_INT 11 getActionBar .setBackgroundDrawable getResources .getDrawable.. getActionBar .setBackgroundDrawable ... ... if android.os.Build.VERSION.SDK_INT 11 new ActionBarHelper .setBackground This way ActioBarHelper..

Screen orientation lock

http://stackoverflow.com/questions/6599770/screen-orientation-lock

.orientation case Configuration.ORIENTATION_PORTRAIT if android.os.Build.VERSION.SDK_INT android.os.Build.VERSION_CODES.FROYO setRequestedOrientation.. break case Configuration.ORIENTATION_LANDSCAPE if android.os.Build.VERSION.SDK_INT android.os.Build.VERSION_CODES.FROYO setRequestedOrientation..

DefaultHttpClient to AndroidHttpClient

http://stackoverflow.com/questions/8706464/defaulthttpclient-to-androidhttpclient

This restriction can be changed using if android.os.Build.VERSION.SDK_INT 9 StrictMode.ThreadPolicy policy new StrictMode.ThreadPolicy.Builder..

AsyncTask, must it take such a performance penalty hit…?

http://stackoverflow.com/questions/8955458/asynctask-must-it-take-such-a-performance-penalty-hit

8706464 defaulthttpclient to androidhttpclient if android.os.Build.VERSION.SDK_INT 9 StrictMode.ThreadPolicy policy new StrictMode.ThreadPolicy.Builder..

How to use an existing database with an Android application [duplicate]

http://stackoverflow.com/questions/9109438/how-to-use-an-existing-database-with-an-android-application

super context DB_NAME null 1 1 its Database Version if android.os.Build.VERSION.SDK_INT 17 DB_PATH context.getApplicationInfo .dataDir databases else..

READ_LOGS permission on Jelly Bean (api 16)

http://stackoverflow.com/questions/11461650/read-logs-permission-on-jelly-bean-api-16

.checkPermission android.Manifest.permission.READ_LOGS pname 0 Log.d TAG we do not have the READ_LOGS permission if android.os.Build.VERSION.SDK_INT 16 Log.d TAG Working around JellyBeans 'feature'... try format the commandline parameter CMDLINE_GRANTPERMS 2 String.format..

How to justify text on a TextView made easy- Android

http://stackoverflow.com/questions/11922861/how-to-justify-text-on-a-textview-made-easy-android

Hardware rendering breaks background color to work as expected. Need to use software renderer in that case. if android.os.Build.VERSION.SDK_INT 11 this.setLayerType WebView.LAYER_TYPE_SOFTWARE null public void setTextColor int hex String h Integer.toHexString hex..

setBackground vs setBackgroundDrawable (Android)

http://stackoverflow.com/questions/11947603/setbackground-vs-setbackgrounddrawable-android

But if you want to be completly correct just for the completeness of it... You'd do something like following int sdk android.os.Build.VERSION.SDK_INT if sdk android.os.Build.VERSION_CODES.JELLY_BEAN setBackgroundDrawable else setBackground For this to work you need to set..

Caused by: android.os.NetworkOnMainThreadException [duplicate]

http://stackoverflow.com/questions/13136539/caused-by-android-os-networkonmainthreadexception

Use Async Task for that. 2 Write below code into your MainActivity file after setContentView R.layout.activity_main if android.os.Build.VERSION.SDK_INT 9 StrictMode.ThreadPolicy policy new StrictMode.ThreadPolicy.Builder .permitAll .build StrictMode.setThreadPolicy policy..

Android 4.2 broke my encrypt/decrypt code and the provided solutions don't work

http://stackoverflow.com/questions/13433529/android-4-2-broke-my-encrypt-decrypt-code-and-the-provided-solutions-dont-work

my AES encrypt decrypt code and Encryption error on Android 4.2 and the provided solution SecureRandom sr null if android.os.Build.VERSION.SDK_INT JELLY_BEAN_4_2 sr SecureRandom.getInstance SHA1PRNG Crypto else sr SecureRandom.getInstance SHA1PRNG doesn't work for me..

Use Roboto font in app with minimum API level 14

http://stackoverflow.com/questions/14631326/use-roboto-font-in-app-with-minimum-api-level-14

. Now you can use the include tag to include the TextView in your Layout. You just have to do this use this then if android.os.Build.VERSION.SDK_INT 11 TextView txt TextView findViewById R.id.myTxtView else TextView_Roboto txt TextView_Roboto findViewById R.id.myTxtView..

Playing HTML5 video on fullscreen in android webview

http://stackoverflow.com/questions/15768837/playing-html5-video-on-fullscreen-in-android-webview

attrs.flags WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON getWindow .setAttributes attrs if android.os.Build.VERSION.SDK_INT 14 getWindow .getDecorView .setSystemUiVisibility View.SYSTEM_UI_FLAG_LOW_PROFILE else WindowManager.LayoutParams.. attrs.flags ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON getWindow .setAttributes attrs if android.os.Build.VERSION.SDK_INT 14 getWindow .getDecorView .setSystemUiVisibility View.SYSTEM_UI_FLAG_VISIBLE webView.setWebChromeClient webChromeClient..

Retrieving Android API version programmatically

http://stackoverflow.com/questions/3423754/retrieving-android-api-version-programmatically

this question As described in the android documentation the SDK level integer the phone is running is available in android.os.Build.VERSION.SDK_INT The enum corresponding to this int is in the android.os.Build.VERSION_CODES class. Code example int currentapiVersion android.os.Build.VERSION.SDK_INT.. The enum corresponding to this int is in the android.os.Build.VERSION_CODES class. Code example int currentapiVersion android.os.Build.VERSION.SDK_INT if currentapiVersion android.os.Build.VERSION_CODES.FROYO Do something for froyo and above versions else do something for..

Get android api level of phone currently running my application [duplicate]

http://stackoverflow.com/questions/3993924/get-android-api-level-of-phone-currently-running-my-application

API version 4 Android 1.6 Donut the current suggested way of getting the API level would be to check the value of android.os.Build.VERSION.SDK_INT which is an integer. In either case the integer you get maps to an enum value from all those defined in android.os.Build.VERSION_CODES..

How do you use Intent.FLAG_ACTIVITY_CLEAR_TOP to clear the Activity Stack?

http://stackoverflow.com/questions/4342761/how-do-you-use-intent-flag-activity-clear-top-to-clear-the-activity-stack

rather than back to activity B again. activity B @Override public boolean onKeyDown int keyCode KeyEvent event if android.os.Build.VERSION.SDK_INT android.os.Build.VERSION_CODES.ECLAIR keyCode KeyEvent.KEYCODE_BACK event.getRepeatCount 0 onBackPressed return super.onKeyDown..

Strategies for Honeycomb & backward compatibility

http://stackoverflow.com/questions/4832262/strategies-for-honeycomb-backward-compatibility

version checking to confirm if the other Honeycomb APIs are available. private static boolean shinyNewAPIsSupported android.os.Build.VERSION.SDK_INT 10 private static boolean fragmentsSupported false private static void checkFragmentsSupported throws NoClassDefFoundError..

VerifyError deploying on API 1.6

http://stackoverflow.com/questions/6495007/verifyerror-deploying-on-api-1-6

compatibility issue when deploying my application on android 1.6. Im getting a VerifyError on this piece of code if android.os.Build.VERSION.SDK_INT 11 getActionBar .setBackgroundDrawable getResources .getDrawable R.drawable.actionbar_bg This is not unexpected since getActionBar.. . You can do next trick class ActionBarHelper void setBackground getActionBar .setBackgroundDrawable ... ... if android.os.Build.VERSION.SDK_INT 11 new ActionBarHelper .setBackground This way ActioBarHelper class will only be compiled verified when you're running on..

Screen orientation lock

http://stackoverflow.com/questions/6599770/screen-orientation-lock

in any Android SDK. switch getResources .getConfiguration .orientation case Configuration.ORIENTATION_PORTRAIT if android.os.Build.VERSION.SDK_INT android.os.Build.VERSION_CODES.FROYO setRequestedOrientation ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else int rotation.. setRequestedOrientation ActivityInfo.SCREEN_ORIENTATION_PORTRAIT break case Configuration.ORIENTATION_LANDSCAPE if android.os.Build.VERSION.SDK_INT android.os.Build.VERSION_CODES.FROYO setRequestedOrientation ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE else int rotation..

DefaultHttpClient to AndroidHttpClient

http://stackoverflow.com/questions/8706464/defaulthttpclient-to-androidhttpclient

executed on UI thread. if you do this you get NetworkOnMainThreadException. This restriction can be changed using if android.os.Build.VERSION.SDK_INT 9 StrictMode.ThreadPolicy policy new StrictMode.ThreadPolicy.Builder .permitAll .build StrictMode.setThreadPolicy policy..

AsyncTask, must it take such a performance penalty hit…?

http://stackoverflow.com/questions/8955458/asynctask-must-it-take-such-a-performance-penalty-hit

html files reset strict mode see http stackoverflow.com questions 8706464 defaulthttpclient to androidhttpclient if android.os.Build.VERSION.SDK_INT 9 StrictMode.ThreadPolicy policy new StrictMode.ThreadPolicy.Builder .permitAll .build StrictMode.setThreadPolicy policy..

How to use an existing database with an Android application [duplicate]

http://stackoverflow.com/questions/9109438/how-to-use-an-existing-database-with-an-android-application

final Context mContext public DataBaseHelper Context context super context DB_NAME null 1 1 its Database Version if android.os.Build.VERSION.SDK_INT 17 DB_PATH context.getApplicationInfo .dataDir databases else DB_PATH data data context.getPackageName databases this.mContext..