1 / 10

Purdue Pride 4.7.10 Joe Gutierrez Tung Ho Janam Jhaveri

Purdue Pride 4.7.10 Joe Gutierrez Tung Ho Janam Jhaveri. Timeline. 7 weeks March 10 th : Widget, RSS tutorials March 24 th : RSS Feed April 7 th : SQL Lite Database (currently working on) April 21 st : Widget April 28 th : Work off any loose ends. Milestones.

tawana
Download Presentation

Purdue Pride 4.7.10 Joe Gutierrez Tung Ho Janam Jhaveri

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Purdue Pride4.7.10Joe GutierrezTung HoJanam Jhaveri Purdue Pride

  2. Timeline • 7 weeks • March 10th: Widget, RSS tutorials • March 24th: RSS Feed • April 7th: SQL LiteDatabase (currently working on) • April 21st: Widget • April 28th: Work off any loose ends Purdue Pride

  3. Milestones • Website with RSS feed is set up (3.3.10) • Basic widget displays hard-coded text (3.10.10) • Successfully store and recall data from SQL Lite with an application (3.24.10) • Successfully retrieve and display RSS feed onto view (4.1.10) Purdue Pride

  4. Database Code public class PrideDB { private static final String FEEDS_TABLE = "feeds"; private static final String DATABASE_NAME = "pride"; private static SQLiteDatabase db; public PrideDB(Context ctx) { db = ctx.openOrCreateDatabase(DATABASE_NAME, 0, null); //API change } Purdue Pride

  5. Database Code public static booleaninsertItem(String title, String description) { ContentValues values = new ContentValues(); values.put("title", title); values.put("description", description); return(db.insert(FEEDS_TABLE, null, values) > 0); } public booleandeleteItem(Long feedID) { return(db.delete(FEEDS_TABLE, "feed_id=" + feedID.toString(), null) > 0); } public static List<RSSItem> getItems() { ArrayList<RSSItem> feeds = new ArrayList<RSSItem>(); try { Cursor c = db.query(FEEDS_TABLE, new String[] {"feed_id", "title", "description"} , null, null, null, null, null); intnumRows = c.getCount(); //API change for( int i =0; i < numRows; ++i) { RSSItem item = new RSSItem(); item.feedId = c.getLong(0); item.title = c.getString(1); item.description = c.getString(2); feeds.add(item); c.moveToNext(); //API change } } Purdue Pride

  6. Database Code catch (SQLException e) { Log.e("PurduePride",e.toString()); } return feeds; } public static RSSItemgetItem() { RSSItem item = new RSSItem(); try { Cursor c = db.query(FEEDS_TABLE, new String[] {"feed_id", "title", "description"} , null, null, null, null, null); item.feedId = c.getLong(0); //item.title = c.getString(1); //item.description = c.getString(2); } catch (SQLException e) { Log.e("PurduePride",e.toString()); } return item; } } Purdue Pride

  7. RSS Handler if (item.title != null) {PrideDB.insertItem(item.title, item.description);item.title = null;item.description = null;                 /*itemsAdded++;                 if (itemsAdded >= ARTICLES_LIMIT) {                     throw new SAXException();                 }                 */             } Purdue Pride

  8. Pride RSS handler.setContext(this); Purdue Pride

  9. Widget XML <?xml version="1.0"?>        //XML file with some metadata about the widget. "Called" in main Widget Java file<appwidget-provider xmlns:android="http://cobweb.ecn.purdue.edu/~vipfor/index.html"        //Dimensions of the widgetandroid:minWidth="240dp"android:minHeight="300dp"        //Update rate of the Widget (set to once every 24 hrs)android:updatePeriodMillis="86400000"        //Layout of widget to be initializedandroid:initialLayout="@layout/purduepridewidget"        //Configuration activity to automatically launch widgetandroid:configure="com.vip.pruduepride.purdueprideConfigure" ></appwidget-provider>      <receiver android:name="PurduePrideWidget" >          <intent-filter>              <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />          </intent-filter>                  <meta-data android:name="android.appwidget.provider"              android:resource="@xml/WidgetXML" />      </receiver> Purdue Pride

  10. Next Task • April 7th: Have RSS feed interacting with database (in Progress) • April 21st: Display RSS feed onto Widget Purdue Pride

More Related