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

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Database » SQLiteDatabase 
Convert From Java Week To Sqlite Week
    
//package org.avelino.mobile.android.budgetfrik;

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

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

/**
 * License http://creativecommons.org/licenses/by-nc-sa/2.5/se/deed.en_US
 * See assets/license.html
 @author Avelino Benavides
 *
 */
class Utils {
  private static final NumberFormat NUMBER_WEEK = NumberFormat.getNumberInstance();
  @SuppressWarnings("unused")
  private static final String TAG = "BudgetFrik.Utils";
  static{
    NUMBER_WEEK.setMinimumIntegerDigits(2);
    NUMBER_WEEK.setMaximumIntegerDigits(2);
  }
  
  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&& 
          clause.evaluate(claz.cast(childAt))){
          result =  claz.cast(childAt);
          break;
        }
        if (childAt instanceof ViewGroup){
          parents.push((ViewGroupchildAt);
        }
      }
      if (!parents.isEmpty()){
        parent = parents.pop();
      else {
        break;
      }
    }
    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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.