Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

  • Be the first to comment

  • Be the first to like this


  1. 1. Comp194-MA
  2. 2. Project Update <ul><li>We decided to postpone fully developing the Facebook picture importer. </li></ul><ul><li>Instead, we extracted some of the code from that to develop an application to import CSV files of your contacts. </li></ul><ul><li>We also developed a Greasemonkey script to extract your Facebook contacts. </li></ul>
  3. 3. Greasemonkey? <ul><li>Fun aside. Greasemonkey is a Firefox extension that allows users to “script” Firefox for specific web sites. </li></ul><ul><li>We wrote a script to extract your Facebook contacts along with their cell phone numbers. </li></ul><ul><li>Currently, the Facebook API does not support this functionality. </li></ul>
  4. 4. Greasemonkey contd. <ul><li>The script works by exploiting patterns in the DOM and then extracting certain elements. </li></ul><ul><li>The script is available at </li></ul><ul><li>You’ll need Greasemonkey - </li></ul>
  5. 5. Back to Android: Preferences <ul><li>Preferences allow you to store simple key/value data for your application. </li></ul><ul><li>Preferences are readable only by your application and must be a primitive type. </li></ul><ul><li>Preferences are retrieved and stored using getSharedPreferences </li></ul>
  6. 6. Preferences Code <ul><li>SharedPreferences pref; // gets prefs </li></ul><ul><li>SharedPreferences.Editor editor; // pref editor </li></ul><ul><li>pref = getSharedPreferences(getClass().getPackage().getName(), Context. MODE_PRIVATE); </li></ul><ul><li>lastUrl = pref.getString(PREF_LAST_URL, null); // retrieve a stored pref </li></ul><ul><li>editor.putString(PREF_LAST_URL, myUrl); // store a new value </li></ul><ul><li>editor.commit(); // commit the change </li></ul>
  7. 7. Android File System <ul><li>Android has a file system that looks similar to a standard Linux file system. </li></ul><ul><li>Paths are separated using a front slash - / </li></ul><ul><li>Applications can also write to files on external memory devices. </li></ul>
  8. 8. Read/Write Files <ul><li>Files can be read using Context.openFileInput() openFileInput returns a standard FileInputStream . </li></ul><ul><li>To write to a file, use Context.openFileOutput() which returns a standard FileOutputStream . </li></ul><ul><li>By default, only your application can access files it creates. </li></ul>