Convert From Java Week To Sqlite Week : SQLiteDatabase « Database « Android

Convert From Java Week To Sqlite Week


import java.text.NumberFormat;
import java.util.Stack;

import android.view.View;
import android.view.ViewGroup;

 * License
 * See assets/license.html
 * @author Avelino Benavides
class Utils {
  private static final NumberFormat NUMBER_WEEK = NumberFormat.getNumberInstance();
  private static final String TAG = "BudgetFrik.Utils";
  private Utils(){}
  public static String convertFromJavaWeekToSqliteWeek(String yyyy_ww){
    String [] split = yyyy_ww.split("-");
    return split[0] + "-" + NUMBER_WEEK.format(Integer.parseInt(split[1])-1);
  public interface Clause<K,V>{
    public V evaluate(K k);
  public static <K extends View>  K findViewInHierarchy(ViewGroup parent, final Class<K> claz,
                                final Clause<K, Boolean> clause){
    K result = null;
    Stack<ViewGroup> parents = new Stack<ViewGroup>();
    while (result == null ){
      int childCount = parent.getChildCount();
      for (int i = 0; i< childCount; i++){
        final View childAt = parent.getChildAt(i);
        if (claz.isInstance(childAt) && 
          result =  claz.cast(childAt);
        if (childAt instanceof ViewGroup){
          parents.push((ViewGroup) childAt);
      if (!parents.isEmpty()){
        parent = parents.pop();
      } else {
    return result;


Related examples in the same category

1.Use SQLiteDatabase
2.SQLiteDatabase and ReentrantLock
3.SQLiteDatabase wrapper
4.SQLiteDatabase Helper class
5.Using Database
6.SQLite based diary app
7.Create table, insert record, delete records, query table, remove table
8.Insert Data into database
9.Searchable Dictionary
10.Sqlite Annotations Helper