Skip to main content

Posts

Showing posts from August, 2015

Portrait/Landscape Mode

Show the Activity / Screen only in Landscape Mode: <activity android:name=".MainActivity" android:screenOrientation="landscape"/> Show the Activity / Screen only in Portrait Mode: <activity android:name=".MainActivity" android:screenOrientation="portrait"/>

Android Set Window Full Screen (No Title)

style.xml <style name=" AppTheme " parent="AppBaseTheme">         <item name="android:windowNoTitle"> true </item>         <item name="android:windowFullscreen"> true </item> </style> AndroidManifest.xml <application                  android:allowBackup="true"         android:icon="@drawable/icon"         android:label="@string/app_name"         android:theme="@style/ AppTheme " > ...........   </ application>

Check Internet Connection

ConnectivityManager cn = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo nf = cn.getActiveNetworkInfo(); if (nf != null && nf.isConnected() == true) {        Toast.makeText(getApplicationContext(), "Internet Connected.", Toast.LENGTH_LONG).show(); } else {        Toast.makeText(getApplicationContext(), "No Internet.", Toast.LENGTH_LONG).show(); }