Sunday, January 3, 2016

It's been awhile


Hard to believe that it's been almost a year since my last post. I have not really been active this pass year with Android app building. Since my last post I've only accounted for about 20 hours this whole time that has passed, though I have dabbled but not enough to write it down.

10,000 hour to Mastery.
10,000 - 654.25 = 9345.75 hours left 

Wednesday, February 18, 2015

Feature creep and the creation of bugs

    I had thought I was finished with my App and just needed to upload it to Google play but then I had an idea to change text color based on the score. Red for down , green for up and black for even. Even a trivial thing such as that introduced bugs bad enough to crash the app. After a bit of work I had fixed the bugs but to be sure I had to fully test the app again. Fortunately it's not very complicated and only a few options.

10,000 hour to Mastery.
10,000 - 634 = 9366 hours left 

Wednesday, January 28, 2015

Spinner text not showing

   The spinner view was working great on newer Android versions . I decided to try on version 2.2, so I started up an emulator running 2.2 and that's when I noticed the trouble. The text in the spinner list was not showing up unless you clicked on it. The actions worked correctly and on other Android versions the text showed. So I tried setting color of text and background but that only effected the spinner and not the drop down list itself. The fix was changing the line:
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);

To:
adapter.setDropDownViewResource(android.R.layout.simple_expandable_list_item_1);

I'm still not sure why the first one did not work.

10,000 hour to Mastery.
10,000 - 631 = 9369 hours left

Tuesday, January 13, 2015

Lint tool

    Lint is an awesome Android tool that is almost never mentioned in Android books. I probably would never had known about it's uses had it not been the need to track down string resources that I needed to remove or translate. The problem began with me doing a beginners mistake, which is hard coding in strings. So I had to track down all of these. As I was doing this I was adding strings to the string.xml resource. In doing this I noticed a lot of strings that might not be needed but I did not want to delete them and perhaps creating a lot of errors. Once again Googling for solutions , I found the answer in the tool Lint. Surprisingly the tool does not run automatically ( there might be a way to set it so it does but I have not found it yet). You have to right click the project, select Android tools and then run Lint. It showed me a list which included  colors and strings not use, strings not translated, missing drawables and conflicting background color ( I was coloring a background that the theme already colored). I have just scratched the surface of what Lint can do. Now I am interested in what other tools are included that might be useful.

10,000 hour to Mastery.
10,000 - 623 = 9377 hours left

Not a lot of hours but I have learned so much.

Wednesday, December 3, 2014

Hard coding text

  The advantage of taking some time off from coding is that when you come back to your project you are sort of looking at it with fresh eyes. I spotted something that should have been obvious before. I had hard coded text and that would be a problem when I added other languages to my app. 

Code before:

public void onItemSelected(AdapterView<?> parent, View view,

int position, long id) {
itemValue = (String) spinnerView.getItemAtPosition(position);
if (itemValue.equalsIgnoreCase("Add Vehicle")) {
// add has been selected so we change screens
addVehicleView();
} else if (!itemValue.equalsIgnoreCase("Add Vehicle"))
// vehicle selected so now we have to update previous fill
// up text
{
getLastSaved(itemValue);

}
                           }
Code after:
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
itemValue = (String) spinnerView.getItemAtPosition(position);
int count = spinnerView.getCount();
if (position == count - 1) {
                                // add has been selected so we change screens
addVehicleView();
} else {
// vehicle selected so now we have to update previous fill
// up text
getLastSaved(itemValue);

}




10,000 hour to Mastery.
10,000 - 619.25 = 9380.75 hours left