Skip to content

Instantly share code, notes, and snippets.

ArrayList<Listing> shows = new ArrayList<Listing>();
String channelId = listings.get(0).getChannelId();
for( Listing listing : listings ) {
if(!channelId.equals(listing.getChannelId())) {
mBlock.add(shows);
shows = new ArrayList<Listing>();
}
shows.add(listing);
}
12-15 21:22:45.302: INFO/NetworkUtils(19961): {"viResponse":{"viResponseCode":200, "viResponseMessage":{"item":[{"type":"current","last_update":"6:51pm, 12/15/2010","unit":"F","current_temp":"29","uv":"NA","weather_desc":"Wintry Mix","dewpoint":"22","relative_humidity":"70%","sky_url":"http://images.charter.net/weathercom/small/7.gif","visibility":"8 miles","barometric_pressure":"29.82 in","barometric_trend":"Steady","wind_dir_text":"ESE","wind_speed":"10 mph","windchill":"20"},{"type":"forecast","status":"valid","day":"0","date":"Wednesday, Dec. 15","unit":"F","high_temp":"--","low_temp":"28","weather_desc_day":"*","weather_desc_night":"Ice Early","sky_url_day":"NA","sky_url_night":"http://images.charter.net/weathercom/small/10.gif","precip_day":"NA","precip_night":"30%"},{"type":"forecast","status":"valid","day":"1","date":"Thursday, Dec. 16","unit":"F","high_temp":"32","low_temp":"21","weather_desc_day":"Cloudy","weather_desc_night":"Cloudy","sky_url_day":"http://images.charter.net/weathercom/small/26.gif"
ImageDownloader imageDownloader = new ImageDownloader();
imageDownloader.download(cursor.getString(url_column), channelLogo);
channel_num.setText(cursor.getString(channel_column));
title.setText(cursor.getString(title_column));
String[] whereArgs = new String[] {
Long.toString(aStart),
Long.toString(aStart)
};
String where = Listings.START_TIME + " <= ? AND " + Listings.END_TIME + " >= ?";
Cursor query = aContext.getContentResolver().query(Listings.CONTENT_URI, projectionMap,
where, whereArgs, null);
private ArrayList<Listing> createListings() {
ArrayList<Listing> result = new ArrayList<Listing>();
Listing listing = new Listing();
listing.setChannelNumber("1");
listing.setFullTitle("TMZ");
listing.setCategory("news");
listing.setStartTime(11111);
listing.setEndTime(10101);
listing.setDuration("1800");
private void insertListings() {
ArrayList<Listing> listings = createListings();
for(Listing listing : listings) {
Log.d(TAG, listing.getChannelNumber());
ContentValues params = new ContentValues();
params.put(Listings.CHANNEL_NUMBER, listing.getChannelNumber());
package com.wmbest.pivotal;
import android.app.IntentService;
import android.content.Intent;
public class PivotalIntentService extends IntentService {
public void onHandleIntent(Intent aIntent) {
switch(aIntent.getAction()) {
default:
package com.wmbest.iphone4;
import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.widget.Button;
import android.view.View;
import com.admob.android.ads.AdView;
public class iPhone4Launcher extends Activity {
10-11 19:15:48.649: INFO/ActivityManager(17687): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.wmbest.iphone4/.iPhone4Launcher }
10-11 19:15:48.707: INFO/ActivityManager(17687): Start proc com.wmbest.iphone4 for activity com.wmbest.iphone4/.iPhone4Launcher: pid=23166 uid=10113 gids={3003}
10-11 19:15:48.949: ERROR/dalvikvm(23166): Could not find class 'com.wmbest.iphone4.iPhone4Launcher$1', referenced from method com.wmbest.iphone4.iPhone4Launcher.onCreate
10-11 19:15:48.949: WARN/dalvikvm(23166): VFY: unable to resolve new-instance 155 (Lcom/wmbest/iphone4/iPhone4Launcher$1;) in Lcom/wmbest/iphone4/iPhone4Launcher;
10-11 19:15:48.949: DEBUG/dalvikvm(23166): VFY: replacing opcode 0x22 at 0x0026
10-11 19:15:48.949: DEBUG/dalvikvm(23166): VFY: dead code 0x0028-0036 in Lcom/wmbest/iphone4/iPhone4Launcher;.onCreate (Landroid/os/Bundle;)V
10-11 19:15:49.027: DEBUG/AndroidRuntime(23166): Shutting down VM
10-11 19:15:49.027: WARN/dalvikvm(231

Reactive Forms with RxAndroid and TextInputLayout

Reactive Programming has been getting a lot of attention in the Android community lately. While it has uses throughout the application stack, we're going to focus here on using it to validate forms (exciting!). This approach cuts down on ugly nested if statements and transforms all of the validation logic to just a few simple lines using the RxJava framework. More, its robust and testable.

This post assumes some knowledge of how RxJava and lambdas work. If you need more of a refresher RxJava Retrolambda

Setup layout with TextInputLayout