So far today I’ve made the actual search function itself work, added hyperlinks to the search results, and added a scrollbar for results which take more room than is available. Additionally, the work for the search now happens in a second thread, so it doesn’t lag the User Interface and generate ANR (Application Not Responding) events. So instead of the UI seeming like it hangs when the user presses the search button, a progress dialog is displayed instead!
One notable performance issue with the application is that the AutoCompleteTextView currently available from google is a little slow, and tries to perform matching too early. I looked around the web and others have grumbled on blogs about this issue, but until Google improves this part of the API, I don’t think there is a fix.
I spent some time this weekend working on GenomeSearch and doing things to my EEEPC, so I could round out my hours for the week (stupid jury duty…).
GenomeSearch update: I tweaked some methods a little bit, and coded the actual search behavior of the app. It isn’t working just right quite yet, but I’ve narrowed down where the problem is. It seems like after I build my hash of the results, I’m not pulling the data out of it correctly. This is likely what I’ll work on tomorrow.
As for the EEEPC, I like the look of the EEEbuntu that Nick gave me. I’m hoping it’ll run my development environment better, because the WinXP was really sluggish on the Android emulator. I managed to delete my taskbar on my last install, so I’m setting up a fresh install now. I’ll write another post sometime with some EEEPC/EEEbuntu gotchas, incase anybody else wants to do this install!
Another in my series of ‘Android development gotchas’.
At Google I/O they made a very big deal over how programs need to request permission from the user in order to access most resources (user’s GPS location, the internet, files, etc). This is an easy one to forget during development however, and it slipped through the cracks on me twice. I actually corrected this problem early this week, but we had to remake our project from scratch due to other issues and I forgot to add the permissions again. Since it caused me a fair bit of headache I thought I’d write up a quick how-to on permissions in Android.
There is a file called the Android Manifest which holds various information about the program (this is generated for you when you make an Android project in Eclipse). Included here is a list of permissions that the program requires. Without these, attempts to do things like accessing the internet will fail. To add permissions, you basically:
Double click AndroidManifest.xml, Click the Permissions tab (at the bottom of the window it brings up), Click add, Click ‘Uses Permission’, Click the ‘name’ dropdown, Find the permission you need and click it. That’s all!
If my pure-text description is less than helpful, I used this link as a guide to figure this all out.
This proved to be a little tricky for me. I ran into a problem where Eclipse wouldn’t show me my variables in my Android app.
Apparently, you can only inspect variables in a specific scope within an Android program. You can’t see class variables, etc. In order to see any variables at all, you need to set a breakpoint somewhere near the area you suspect is a problem.
I’m not sure if I needed to do this, but one other thing I did before I got the debugger to finally show me variables was adding the tools directory to my PATH. The explanation for this can be found in this guide. Note that those files are hidden, so you’ll have to learn how to view them on whatever OS you’re using!
Today (while I sat waiting to be called at jury duty for 7 hours…) I worked on restructuring the GenomeSearch program. It had become a bit of a cluttered mess since I originally made the class as a test class for putting pieces of tutorials together.
Now the program is laid out a lot more logically and in better OOP style. It took a fair bit of work, but I think that having a more sensible groundwork will keep our future work organized. I also worked a bit on getting the spinner to display the genomes from the seed, but this work is not complete just yet. I feel like what I’m uploading is pretty close to what Daniel and I need, however!
This post will consist of mainly links to guides which I used in setting up my development environment to write Android apps.
Step 1. Install Eclipse as per usual http://www.eclipse.org/downloads/ (I always install the Classic package, but I’m not sure if that is the best way to go)
Step 2. Download the Android SDK http://developer.android.com/sdk/1.5_r2/index.html (I don’t think it matters where you unzip it to, as long as you can find it later)
Step 3. Follow set up instructions http://developer.android.com/sdk/1.5_r2/installing.html
Step 4. Learn about how to create and run Android projects http://developer.android.com/guide/basics/what-is-android.html
A few gotchas:
Android has a built in JSON feature which is explained here: http://developer.android.com/reference/org/json/JSONObject.html
Java does not ordinarily have JSON packages included (as far as I know), and if you include json_simple or similar packages, Eclipse will no longer recognize the Android JSON package.
This happened to me, and I had trouble figuring out how to tell Eclipse to ignore the package I no longer wanted. An easy work-around is to remake your project and copy/paste source files.