Home Blog
Blog
New Android App PDF Print E-mail
Written by Eugene Johnson   
Tuesday, 29 March 2011 17:41

A couple weeks ago I published a new Android app to the market. It's a lightweight power saving app that shuts off the WiFi on a given schedule. I admit there's some impressive apps out there that have a lot of features, but I'm the type that doesn't use GPS or Bluetooth or anything like that. I mostly just use my WiFi and so do most people I know. So those features are usually off all of the time anyway. I, as well as most everyone else I know, also keep my apps running in the background to the bare minimum. However, I usually have WiFi available everywhere except for when I'm driving, so I don't have a great need for a WiFi scheduler. But there are a lot of people who don't have WiFi available during regularly scheduled parts of the day/week.

 

A couple weeks ago someone asked me "why is there not an app that only turns off WiFi when you don't need it? I know there's apps for fancy pants power management, but I don't need all that!" So, I decided to build it. It has actually gotten a little better response than I anticipated. In the short few weeks it has been online, it's already up to 207 downloads, 106 active, and 5 comments (some better than others).

 

All in all, it was a fantastic experiment and I enjoyed working on the project. It's going to be interesting to see what happens with it.

Last Updated on Tuesday, 29 March 2011 18:05
 
Android - Change Text Color of ListView PDF Print E-mail
Written by Eugene Johnson   
Monday, 16 August 2010 03:06

I spent quite a while trying to find this info and I often forget things, so I'm putting it here so I can find it again easily and hopefully others will find this useful.

My project was pretty simple. The ListView I was creating wasn't very complicated. I wasn't looking to customize it with multiple columns, images, or anything of the sorts. I just wanted to change the color of the text so I could see it against my background. And Android doesn't provide a simple way to do this. Actually...there is a simple way to do it, but it's not intuitive.

The solution is actually pretty simple. All you have to do is create an XML file in your res/values directory of your project. The name of the XML file is arbitrary, but it should look something like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="BlackText">
<item name="android:textColor">#000000</item>
</style>
</resources>

This is akin to a stylesheet in HTML/CSS web development. It can be applied to specific views (i.e. a ListView), an Activity, or an entire Application, much the same way stylesheets can be applied to specific page elements using style="", an entire page using <style></style> or linked on every page of the site using <link/>.

The way you apply it to an entire application is to open the AndroidManifest.xml, look for your <application> tag, and add android:theme="@style/BlackText" (note that my <style> tag above has a name="BlackText" attribute, which is what is used in the android:theme="" attribute).

The way you apply this style to a specific Activity, add the android:theme="BlackText" attribute to the <activity> tag of your choice in your AndroidManifest.xml file.

To apply it to a specific view, add a style="@style/BlackText" attribute to the view tags (i.e. <TextView>) of your choice in any of your layout XML files you have.

That's it. Enjoy!

For more information see: Applying Styles and Themes | Android Developers.

Last Updated on Monday, 16 August 2010 03:19