Search found 35 matches

Go to advanced search

by vivekkalady
Fri Nov 21, 2014 2:09 pm
Forum: Tutorials & Examples
Topic: Splash Screen in Android
Replies: 0
Views: 388

Splash Screen in Android

This is the basic way to create a splash screen This method uses Handler class and the function postDelayed with 2 seconds delay. public class SplashScreen extends Activity { // Splash screen timer private static int SPLASH_TIME_OUT = 2000; @Override protected void onCreate(Bundle savedInstanceState...
by vivekkalady
Wed Nov 19, 2014 4:25 pm
Forum: Tutorials & Examples
Topic: Square Cells in Grid with SquareImageView
Replies: 0
Views: 1317

Square Cells in Grid with SquareImageView

squareimageview.png Square Image View Below is the code for squareimageview public class SquareImageView extends ImageView { public SquareImageView(Context context) { super(context); } public SquareImageView(Context context, AttributeSet attrs) { super(context, attrs); } public SquareImageView(Cont...
by vivekkalady
Wed Nov 19, 2014 4:03 pm
Forum: Tutorials & Examples
Topic: Check Internet Connectivity
Replies: 0
Views: 389

Check Internet Connectivity

How to check for internet connectivity before requesting public boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); return netInfo != null && netInfo.isConnectedOrConnecting(); } ...
by vivekkalady
Wed Nov 19, 2014 3:34 pm
Forum: Tutorials & Examples
Topic: dp to px conversion in android
Replies: 0
Views: 574

dp to px conversion in android

This is the formula dp to px public int dpToPx(int dp) { DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); return px; } px to dp public int pxToDp(int px) { DisplayMetrics displayMetrics ...
by vivekkalady
Wed Nov 19, 2014 3:17 pm
Forum: Tutorials & Examples
Topic: Get Screen Width and Height in Android
Replies: 0
Views: 1586

Get Screen Width and Height in Android

There are Different methods in android to get the screen width and height Display Metrix DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; If you are in a view you have to use...

Go to advanced search

cron