Skip to content

Instantly share code, notes, and snippets.

public class AppDialog {
public static void showInfoDialog(Context _context, String _message,
DialogInterface.OnClickListener okClickListener) {
AlertDialog.Builder dialog = new AlertDialog.Builder(_context);
dialog.setMessage(_message);
dialog.setPositiveButton("OK", okClickListener);
dialog.show();
}
public class AppPreferences {
private SharedPreferences preferences;
private SharedPreferences.Editor editor;
private static AppPreferences instancePreferences;
/**
public class Connectivity {
/**
* Get the network info
* @param context
* @return
*/
public static NetworkInfo getNetworkInfo(Context context){
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo();
public class Constants {
public static final class Database {
public static final String DB_NAME = "test_db.sqlite";
}
}
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<shape>
<corners android:radius="20dp" />
<gradient
android:angle="-90"
android:centerColor="@android:color/black"
public class KeyboardUtility
{
public static void hideSoftKeyboard(Activity activity)
{
try
{
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
}
catch (Exception e)
public class Global {
public static DBConnect dbObject;
// create test_db.sqlite in assets folder with sqlite version 3.0
}
public class FbHelper {
private Context mContext;
private Activity mActivity;
public static final String POST_SUCESS = "post_sucess";
public static final String POST_FAIL = "post_fail";
public static final String POST_LOGIN_NOTFOUND = "post_login_notfound";
@JChudasama
JChudasama / ClassUtils.java
Last active August 29, 2015 14:27
Database Demo
public class ClassUtils {
public static String objectToInsert(Object mainObj) {
Field[] fields = mainObj.getClass().getFields();
String key, value;
// System.out.println("Number of fields = " + fields.length);
StringBuffer keyData = new StringBuffer(" (");
StringBuffer valueData = new StringBuffer(" VALUES(");
Vector<String> arrKey = new Vector<String>();
public final class Log {
public static boolean DEBUG = true;
public static String TAG = "TestDB";
public static void v(String msg) {
if (DEBUG)
android.util.Log.v(TAG, msg);
}