We are working on something exciting, more on that next week (hopefully). One of the things we needed was a way to access files on a device, e.g. images, etc. however this is a painful and fragmented subject. Most of my files are still on my laptop and not on my tablet or phone and moving them back and forth isn't
convenient... Luckily we have Dropbox
, this neat tool has really helped us collaborate as a startup and has made many painful things remarkably easy. So Chen came up with an amazing plugin that allows us to treat drop box as yet another file system we can use to extract files from!
(He made use of some excellent work contributed to the community by Eric Coolman
for Oauth 1.x support!). This is absolutely spectacular and hugely convenient! You can download his source code here its a Codename One Library project so you just compile it in NetBeans then add it to the lib directory of either Eclipse or NetBeans. Then right click the project
and press refresh libs and it should "just work".
This is a brand new project and Chen would love some contributions and collaborations there so feel free to contribute. So how do you use it? First you need to create a Dropbox core application here , this will give you the two keys you need below. Keep in mind that in order to use it for more than one account you will need to select an option during the process and in order to use it in production you will need specific approval. Notice: for this code to work properly you will need a "proper" browser component, so you will need Java 7 to be configured properly with FX so the browser component will work as expected on the simulator. First you just need to login:
The code above logs in to Dropbox then invokes the Dropbox file picker code which I'll show you below using our tree component.
The code below completes the picture by creating a file picker tree allowing us to download a file from dropbox and do whatever we please with it!
Notice: This post was automatically converted using a script from an older blogging system. Some elements might not have come out as intended.... If that is the case please let us know via the comments section below.