Android Programming Tutorials

(Romina) #1
No, Really Listening To Your Friends

Figure 34. The timeline as displayed in Patchy

Most likely, you will find that some poll requests fail with a


"TwitterException: -1" recorded in LogCat. This is due to some issue with


the identi.ca Web service disconnecting some API requests. It should


succeed much of the time, and so these sporadic failures are not your fault.


Here is a full implementation of Patchy after all of the above changes:


package apt.tutorial.two;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import winterwell.jtwitter.Twitter;
import apt.tutorial.IPostListener;
import apt.tutorial.IPostMonitor;

193
Free download pdf