1. Are you ready for the Galaxy S20? Here is everything we know so far!

Very general development question

Discussion in 'Android Development' started by HerroRygar, Dec 2, 2009.

  1. HerroRygar

    HerroRygar Lurker
    Thread Starter


    I'm a university student, majoring in computer science. I've worked in a number of languages (including java, c++, SPARC assembly, and VB.NET). As a student, I don't really have tons of development experience beyond school assignments, and programs I've written for fun/friends.

    I have a really good idea (at least, I think it's a really good idea) for an android application. There is still quite a bit that I need to learn, study, practice, break, fix, and do before I'll be anywhere near deploying this...but I'm already getting stuck on a very silly, somewhat initial step.

    What are my options, as a developer, for using a file that is encoded in some way? Let's say, for example, that my program involved using Excel spreadsheets. All of the projects we've done in school so far have been using files encoded in something relatively simple, like plain text, html, c++ source code, etc. so I have no idea how to even begin processing a complex file type, such as a .xls, or a .mp3, or something along those lines.

    1. Download the Forums for Android™ app!


  2. wige

    wige Newbie

    Excel spreadsheet files are not too bad. They are plain text, mostly XML files, so you should be able to get the information you need relatively easily. I think the best way to go about figuring it out would be to create a spreadsheet on your computer and explore it using notepad.

    To exploring the file yourself, the first step is to rename the file, changing the extension to .zip. You might need to use the command line to do this if you have your system set up to hide known extensions. Once the file has a .zip extension, use WinZip or a similar utility to open the file. (In java, this should be pretty easy, since there are several classes for working with archive files.) Inside you should find three folders and an XML document (assuming you are using Excel 2007 or later). In the xl folder there will be an XML document called workbook, which contains information about the various sheets in the file. In the worksheets subfolder, there will be an XML document for each worksheet, containing it's data. Most of the remaining files contain style information, background calculations, macros, and other data.

    For Java, the Apache group has a project called Apache POI which is developing Java APIs to work with Microsoft Office files. You can get more information and access the libraries here: Apache POI - the Java API for Microsoft Documents

    You can get full information about how the xlsx file format works, and Microsoft's own extensions to the format, from the Microsoft Developer Network here: [MS-XLSX]: Excel Extensions to the Office Open XML SpreadsheetML File Format (.xlsx) Specification
  3. HerroRygar

    HerroRygar Lurker
    Thread Starter

    Thank you for that very thorough answer! I appreciate you taking the time to write that, link to those resources, etc.

    ...but I guess I wasn't being clear. ;)

    An excel file was just an example of a more complex file type - to be honest, it's not really related to what I want to work with. The file type in question is .ptb, a powertab file. Powertab is a piece of software for musicians that allows for the creation and sharing of tablature, a simplified form of sheet music that most guitarists prefer. It also includes MIDI playback.

    Basically, I wanted to write a simplified android app that only allows the viewing and playback (no creation/editing) of the powertab file format. Too often I have my guitar but no computer around. It'd be great to be able to learn songs from my phone...but the powertab file format is...crazy. I tried opening it in notepad, and it looks like somebody opened Microsoft Word, and wrote a novel in Wingdings...hence this post. How would a typical developer get started on this sort of thing?
  4. regulatre

    regulatre Newbie

    If I understand what you're staying, you want to take a ptb file and open it on your Android phone. Since there isn't an app for this, you are considering writing your own app to open the file.

    The files appear to come from this Windows application: Power Tab Editor - Wikipedia, the free encyclopedia

    I did some web searches and it looks like other people have done what you're looking to do, just in different ways, not for Android.

    Java Powertab Parser - Power Tab Developers Support | Google Groups

    What you need to do is first get to know the ptb file format. Forget about using wordpad or notepad, you need to get your hands dirty and start using a hex editor.

    For this type of project I like to export the hexdump to a text file (pipe file through od -t x1 in linux) . Then I can organize the bytes into 2d shapes that represent the data types. In the case of PTB my initial findings suggest that the notes are stored "mfc rect" which sounds like a 2d integer array. My guess is that within this array, each element is an integer that represents the type of note. Depending on the array's row and column this may depict where the note goes on the cleff.

    etc. etc. It's a reverse engineering project, At least until you get to know the ptb format. Then you can have all kinds of fun coding it for Android :)

  5. HerroRygar

    HerroRygar Lurker
    Thread Starter

    There we go - that's exactly what I needed, thank you! I'm using a nice freeware hex editor to help get a feel for the file format. So far, so good, but it is a complicated file format, so this will likely take me awhile. I don't expect to have this app coded any time soon. Thank you so much for your help! :D

Share This Page