Back to project page droidkit-engines.
The source code is released under:
MIT License
If you think the Android project droidkit-engines 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.droidkit.engine._internal.util; /*w w w. j av a2 s. co m*/ import android.content.Context; import android.os.Handler; import android.os.Looper; import android.widget.Toast; public class Utils { // public static final Handler handler = new Handler(Looper.getMainLooper()); public static boolean isUIThread() { return Looper.getMainLooper().getThread() == Thread.currentThread(); } // public static void showToast(final Context context, final String text) { // if (context != null) { // handler.post(new Runnable() { // @Override // public void run() { // Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); // } // }); // } // } public static int dpToPx(final Context context, final int dp) { // Get the screen's density scale final float scale = context.getResources().getDisplayMetrics().density; // Convert the dps to pixels, based on density scale return (int) ((dp * scale) + 0.5f); } }