Jan
08
2010
0

AudioManager Widget for Android

Every once in while there is an application that makes your life a lot easier.  Sometimes that application is a widget.  Such is the case with AudioManager for Android.  This widget does what it name implies; it allows you to manage your android device’s various audio levels.  This includes the alarm level, media level, ringer volume, and much more.

The application sits neatly on one of your homescreens  It takes up a 1×4 block of space on the screen and looks good with vibrant colors.  These colors do much more than just look good: they are functional, informing you of the volume levels in the categories of:

  • Alarm
  • Music
  • Alerts
  • Ringer
  • System
  • Voice

Homepage

Clicking on the widget will fire the console window.  From here you can use sliders to set the volume levels for the alarm, medial player, alerts, ringer, system, and calls.

console

And that’s about it for the program.  Its simple, yet effective.  And in Android that usually makes for the best applications.  Get AudioManager from the Android market by searching it or scanning the QR code below:

Add to Del.cio.us RSS Feed Add to Technorati Favorites Stumble It! Digg It!
    www.sajithmr.com

Sphere: Related Content

Written by Maliek Mcknight in: Application Reviews | Tags: , , , , ,
Jan
06
2010
0

Starting Android Development Part 3: Layout Tutorial 2

As promised, here’s part two of my coverage on layouts in Android.  Lets pick up where we left off, namely we just created a main.xml file for layout of our temperature conversion application.

So you know what we’re trying to achieve here, here’s a screenshot of the final product.

temp_screen_final

I know what you’re thinking.  That’s not that cute of a layout.  I’ll leave the job of making really pretty layouts to you after you learn the basics.  For now this layout will do to show you how making layouts in Android works.

This layout consists of a TableLayout (A Linear Layout could have done here as well).  Each table row has other items embedded in it.  One row even has a TableLayout embedded within it (just to show that you can do this).  This is a valid layout, but is generally frowned upon, as embedding table layouts within table layouts can lead to slower UI performance in the long run.

Here’s the code for the layout:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout
android:id="@+id/widget45"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff0000ff"
android:padding="10px"
android:text="Temperature Conversion App"
android:textSize="18px"
android:typeface="sans"
android:textStyle="bold"
>
</TextView>
<TableLayout
android:id="@+id/widget62"
android:layout_width="319px"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TableRow
android:id="@+id/widget63"
android:layout_width="149px"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<EditText
android:id="@+id/User_input_F"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:text=" "
>
</EditText>
<TextView
android:id="@+id/widget78"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(ºF)"
>
</TextView>
</TableRow>
<TableRow
android:id="@+id/widget64"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<EditText
android:id="@+id/User_input_C"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:text=" "
>
</EditText>
<TextView
android:id="@+id/widget79"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(ºC)"
>
</TextView>
</TableRow>
<TableRow
android:id="@+id/widget65"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<EditText
android:id="@+id/widget83"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:text=" "
>
</EditText>
<TextView
android:id="@+id/User_input_K"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="(ºK)"
>
</TextView>
</TableRow>
</TableLayout>
<TableRow
android:id="@+id/Conversion"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="@+id/conversion"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Convert to:"
>
</TextView>
<RadioGroup
android:id="@+id/widget144"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RadioButton
android:id="@+id/F_Select"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Fareinheit"
>
</RadioButton>
<RadioButton
android:id="@+id/C_Select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Celcius"
>
</RadioButton>
<RadioButton
android:id="@+id/K_Select"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Kelvin"
>
</RadioButton>
</RadioGroup>
</TableRow>
<TableRow
android:id="@+id/widget84"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/Calculate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Calculate"
>
</Button>
</TableRow>
</TableLayout>

Note how each element has an id attribute (android:id) and the value of that attribute starts with “@+id/name“@+id/” identifies the name by which you can refer to this layout element later in your java programming.  Other things to note include:

  • android:layout_width and android:layout_height: Use these to determine how much space an element is going to take up.  These can have two values: wrap_content and fill_parent.  Wrap content means the element will only be as large as it needs to be to display its content.  Fill_parent means the element will fill all available space it can, as determined by the parent element it resides in
  • To find the attribute applicable to a given layout, check out that layouts documentation at the developer.android.com/reference website.  E.g. the API site for TableLayout is
    http://developer.android.com/reference/android/widget/TableLayout.html. I usually find the page i need by just searching “android layout” and the name of the element I’m using

In the next post of this series I will discuss some common Android layout elements, what they look like, and some of the attributes associated with that element.  Then it’ll be time to connect our layout (frontend) to the logic that makes it work (the backend).  For now check out the code I provided, try to understand how it works, and practice creating your own Android layouts!

Add to Del.cio.us RSS Feed Add to Technorati Favorites Stumble It! Digg It!
    www.sajithmr.com

Sphere: Related Content

Jan
05
2010
0

Starting Android Development Part 3: Layout Tutorial 1

Now that I’ve bored you to death with details about how Android programming works, lets actually put something together, shall we?  This post will deal mainly with creating layouts in Android and will finish up with a sample layout for our Temperature Conversion project.

For what Google has to say about layouts check out their developers site at http://developer.android.com/guide/topics/ui/index.html.

Now let me explain a little of what you read.  Layouts for Android screens are described in XML files in your /res/layout/ folder.  The XML file describes a hierarchy of layout elements.  The higher level elements determine the where of your layout and the lower level elements within these elements determine the what of your layout.

Ok that was a mouthful.  Lets look at the simple example Google provided:

<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:orientation=”vertical” >
<TextView android:id=”@+id/text”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Hello, I am a TextView” />
<Button android:id=”@+id/button”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Hello, I am a Button” />
</LinearLayout>

The Linear Layout describes the where, e.g. how the elements within this tag are going to be positioned in relation to each other.  TextView and Button are two lower level elements which are UI elements the user will interact with (a box in which to enter data and a clickable button, respectively)

The result of that layout is listed below.  Note the fact that Linear Layout makes the elements line up one below another (We’ll get into the alternative options later).

Click Me to Make Me Bigger!

Armed with this knowledge, lets try to make our own Layout.

  • Go to File > New > Other
  • Click on Android > Android XML file
  • Click Next
  • In the resulting screen fill out the following values:
  • Project: Click Browse and select the project you want to associate this XML file with (for this demonstration it would be whatever you named the temperature conversation application project)
  • File: Call this file main.xml
  • Click Layout for the type of resource
  • Choose Linear Layout for the root element of the XML file

Everything should look similar to the screenshot below:

Picture 5

  • Click Finish

In the coming posts in this series I will go over an actual layout and discuss some of the common layout elements for Android programs.  Stay Tuned!

Add to Del.cio.us RSS Feed Add to Technorati Favorites Stumble It! Digg It!
    www.sajithmr.com

Sphere: Related Content

Jan
04
2010
0

Theme Review: Dark Dream

DarkDreamLogo

Here’s one of my favorite CM themes so far.  Dark Dream is a dark, glossy theme for Android.  Currently in version 1.8.1.2, this theme has been around for a little while and features a sleek, streamlined look for your phone.  If you’re into dark themes like I am this is a winner.  Here are some of its features:

The functionality of this theme begins before you even unlock your phone.  Pressing the on button reveals a screen showing the time and other information about your phone.  From this (and screens linked to it) you can see your battery level, control your music playing on your android device, and even display a message giving contact information to someone who might find your phone if you lose it.

on musiccontrol on3 on4 lock status

The unlock screen is nice as well, blending in with the rest of the theme:

lock2

Also of interest are the home screens, which have hints of design based in Android 2.0:

widgets home

Overall, I really like this theme.  The dark colors have a nice sheen / glossy edge to them and pop off the screen as result making for a nice UI experience.  Definitely worth a try for anyone with Cyanogen Mod.  If you want to try it, just scan the following QR code, or check the Dark Dream XDA-developers post.

Screenshots

apps contact dailer home loading loading2 lock lock2 lock status music musiccontrol notify on on3 on4 widgets

Add to Del.cio.us RSS Feed Add to Technorati Favorites Stumble It! Digg It!
    www.sajithmr.com

Sphere: Related Content

Jan
02
2010
0

Starting Android Development Part 2: Project Structure

In Part One of Starting Android Development, we discussed setting up your project in Eclipse.  Now it’s time to explain exactly what’s going on and how Android development works.  This information will help you keep things in perspective as you program, and it will help you when it comes to debugging time.

Let’s take a look at the Eclipse screen after you’ve set up a given project:

Picture 6

For the purposes of this explanation, let’s look at the directories in the left pane of the Eclipse screen.  Under the name of the project you’ve just created, you should see several subfolders.  Let’s explain what they do:

  • src: This holds the source code for your project.
    • com.droidweb.conversion: This is the package holding your source code.  Several packages can make up a single project.  This is especially true when you include others’ packages to provide some type of functionality for your program.  For example, in a conversion application I wrote (ConvertAll+), I imported a package to handle different currencies.
      • convert.java: Inside the package are individual .java files.  This is where the goodies (the source code itself) are.
  • gen: This is a folder for automatically generated stuff Android uses to help your program operate properly.  There’s nothing in here that you need to mess with.  It will automatically update itself as necessary.  Sometimes when you import projects and they return errors, the solution is to delete this folder and let Eclipse regenerate it for you . . . but more about that later.
    • com.droidweb.conversion: This is the package holding automatically generated code corresponding to the package of the same name in the /src/ folder.
      • R.java: R.java is an automatically created and maintained file that keeps up with the resources your project utilizes.  In a lot of your Android programming, you’re going to use static variables that really translate into numerical (usual hex) values.  R.java makes the translation between these variables and their numerical values.
  • Android 1.5 (or appropriate Android source version): This contains the actual Android source code on top of which you’re going to build your applications.  As such, I’m not really going to discuss this much.
  • assets:  Why, this is what you set your — oh wait — wrong thing. . . . Usually you won’t mess with this folder, but if you have raw files to be read by your application, then they can be put here; but it’s probably better that it goes in the /res/raw folder.  More about that later.
  • res: res stands for resources.  Here is where you put your resources (images, files, etc).
    • drawable: This is where the images you’re going to use go.  Android supports a variety of image files, including .jpg, .gif (static), png, etc.
    • layout: This is where the .xml files describing your program layouts go.  I’ll spend a post on those later.
    • values: This is where .xml files defining values can be stored.  An example is a network topography program I worked on.  In the custom view drawing routine, I predefined the colors of good / bad links in a .xml file in the /srv/values folder.
  • AndroidManifest.xml: This is the file that will be the source of the most headaches for you (well, starting out it will be . . .).  This is where your project is described in a form that Android devices can understand.  Application permissions, activity descriptions, and more are found here.  This file itself will be the topic of a future post onto itself — yes, it’s that important.

Next time we’ll discuss program flow in a typical Android program.

Add to Del.cio.us RSS Feed Add to Technorati Favorites Stumble It! Digg It!
    www.sajithmr.com

Sphere: Related Content

Powered by WordPress. Theme: TheBuckmaker. Kredit trotz Schufa, Energetisierung

Technology blogs