Powered By:
Android Advice
 

Programming

Solution to java.io.FileNotFoundException when performing an Oauth Request

Posted by on May 20, 2013 at 12:10 pm

Problem When doing an Oauth request the following error is thrown “java.io.FileNotFoundException” Cause The request is not signed. Solution Sign the request first, before actually performing the request. You can either do this manually following the OAuth guidelines or use a simple 3rd signing library recommended by Oauth e.g. Signpost (https://code.google.com/p/oauth-signpost/)

Enums for Older Java Versions

Posted by on May 17, 2013 at 12:51 pm

Enums only became available in J2SE 5.0 If one wants to achieve enum type behavior in Java prior to version 5.0 then one would have to use a type-safe enum pattern. Which would go something like this: Step 1 – Create the Base Enum Class public abstract class Enum { private final String name; private [...]

Android – How to get a File into Memory

Posted by on May 14, 2013 at 1:10 pm

To get a file in the Android file system into memory is really easy. Example: import android.os.Environment; import java.io.File; File theFirstOne = Environment.getExternalStorageDirectory().listFiles()[0]; if(theFirstOne.isDirectory()) { //this is a directory } else { //this is a file }