Android: creating 9-patch image


This tutorial shows how to create a stretchable 9patch image on Mac OS. 



Step 1) 
Prepare some cool image to practice on.
Find on Internet (bad designer), or draw a button background image you really like:


Step 2)
Download Android SDK
http://developer.android.com/sdk/index.html



Step 3)
Install the Android SDK in your preferred location,  for me it is in:

example: $ /Applications/Android/adt-bundle-mac-x86_64-20130522/sdk/




Step 4) 
Add Android SDK tools to your system PATH

4.1 Open Terminal by: 
Open Launchpad and type in search "ter" and select Terminal




4.1 Edit your .profile
In Terminal type $ edit ~/.profile 
This should open default editor in my case TextWrangler with .profile 

4.2 Add following lines on the bottom adjusted for your installation directory

export ANDROID_HOME=/Applications/Android/adt-bundle-mac-x86_64-20130522/sdk/
export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools




4.3 Save file 
4.4. To refresh system, open NEW Terminal window by pressing on Terminal and click "command n"
see if you can see correct tool
$ which draw9patch

/Applications/Android/adt-bundle-mac-x86_64-20130522/sdk//tools/draw9patch

SUCCESS!

Step 5)
Open 
draw9patch tool by typing
$ draw9patch




Step 3) drag the image to the draw9patch tool and try to draw pixels on the edges of the image
  • left and top edges are for stretching areas
  • right and bottom are for (text) content area



actual 9patch file when saved, notice the file has name.9.png name and keep the 9 part:


final result




example with VERTICALLY non-stretchable image:



    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView1"
        android:layout_below="@+id/textView1"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="44dp"
        android:background="@drawable/back_button_normal"
        android:gravity="left|top"
        android:text="Good, this is what we wanted! :)"
        android:textColor="#CCCCCC" />






When you are working with images that have non-stretchable elements in them, you might define 2 stretching points. Also, it is a good practice to define a STYLE GUIDE if you need to create a set of 9patch images as in the case below:


  • left 16 (upper stretch)
  • left 26 (lower stretch)
  • right 9 (upper edge of text)
  • right 33 (lower edge of text)
  • bottom 8 (left margin)
  • bottom 16 (right margin, before arrow)
  • top 15 (any pixel inside text area)


Example with 2 stretchable areas


Enlarge and study the image.

You can see in the image above that I count 16 pixels on the left so the stretch is always in the same point of the bevel. I try to avoid stretching such images with bevel and create them "to size" vertically.

I leave 8 pixels as the margin on the left, and 4 pixels from the drop-down arrow which cannot stretch.
I leave 9 pixels from the top and bottom because in other images of this set I have rounded corners.

You can visualize the final image after stretching on the right-hand side (image in the middle).

Make sure to +1 our Google Developers Group page:


Shameless plug:
Visit my company website CyberWalkAbout.com for example of great work we have done and inquire about very competitive (low) rates of design and development we offer at info@CyberWalkAbout.com




As an Amazon Associate I earn from qualifying purchases.

Android Market Enigma

I have deployed "SF Bay Area Local Guide" over 24 hours ago and I got few downloads, yet the app is not showing on either Web Android Market, nor mobile version for any device I own.

Any suggestions?





As an Amazon Associate I earn from qualifying purchases.

Android ADT 14 Declares War on My Code!

The error comes up only when compiling the project, it started happening when I updated tools in Eclipse to ADT 14, but others had it in prior versions.

Unable to execute dex: Multiple dex files define

Conversion to Dalvik format failed with error 1
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/cyberwalkabout/common/DistanceUtils;




We have been using multiple project libraries for months, but now including them causes a problem as some of them are referenced more than once. 



SOLUTION is listed here: http://ukitech.blogspot.com/2012/06/javalangillegalargumentexception.html




Other problems encountered:

Updates (Android ADT 14) in Eclipse Indigo that introduced these problems:










switch() to if-then



Among many, many things that went wrong today this one was was annoying because of many places I had to change, but at least quick to fix.

Android ADT 14 decided that it does not like to use R.id.reference as a parameter to switch statement and it had to me changed to if-then.



So all of the switch statements had to be converted to if-then. Thankfully there is a shortcut for that (command-1).







As an Amazon Associate I earn from qualifying purchases.

720AM WGN The Voice Of Chicago covers Taxi Share


'With three touches to your phone, you'll get to where you need to be with fellow passengers.' 

Taxi Share Chicago App


Steve and Johnnie visit with Dan Foder, one of the co-creators of the Taxi Share Chicago app which allows you to meet / communicate / coordinate with other folks looking to share a cab.



http://www.wgnradio.com/shows/stevejohnnie/wgnam-sj-taxi-share-chicago,0,2436828.mp3file


As an Amazon Associate I earn from qualifying purchases.

Haplogroup R1b1b2a1a1d1

I tested to belong to Haplogroup R1b1b2a1a1d1.

Subclade R1b1b2a1a1d1* (as named by 23andMe) or R1b1a2a1a1a4 (per FTDNA) is a paternal (male) lineage linked to regions once submerged by the North Sea—historically known as parts of Doggerland—thus tracing deep ancestry in northwestern Europe.

Individuals in R1b1b2a1a1d1 belong to the broader branch R1b1b2a1a1d, defined by testing positive for L47. In genetic terms, this subclade falls under the larger umbrella of R1b-U106 (L48), often associated with early Germanic-speaking populations, including Anglo-Saxons who settled in Britain after the Roman withdrawal in the fifth century AD. There are references to certain Frisians (sometimes called “Frisiavones”) who may have traveled with the Roman XX Legion into Britain, although historians still debate the specifics.

The designation of R1b1b2a1a1d1 has been confirmed via SNP (Single Nucleotide Polymorphism) tests showing characteristic mutations U106, L48, and L47. The presence of L47, located immediately downstream of L48, refines the classification: Those testing positive for L48 but negative for all other subclade markers were traditionally assigned to R1b1b2a1a1d. With the discovery of L47, they now fall under R1b1b2a1a1d1.

Cloud family of Wiltshire, England


Another notable lineage belongs to William Cloud (b. 1502) of Wiltshire, England, cited as the earliest-known common ancestor for certain R1b1b2a1a1d1* subclades. Historical records from the reign of Edward III (1327–1377) mention a Robert atte Cloude in Somerset, alongside references to a Richard Clode. Descendants, including William Acree of Hanover County, Virginia—sometimes called the “Virginia Acrees”—reportedly emigrated to North America in 1682 with William Penn.

Horobin family of Staffordshire, England


The Horobin family also reports a lineage extending to the 1430s in Staffordshire, England. Their DNA results connect them to R1b1b2a1a1d1.

Wiebe family of Friesland, Netherlands

Wiebe is notably common among Dutch Anabaptists (often Mennonites) who originated in the Netherlands or Friesland. In the 16th and 17th centuries, many fled religious persecution, initially relocating to areas in Prussia (particularly the Vistula Delta),

In at least 16 independently tested Wiebe families, the males belong to R1b1b2a1a1d1*.

Mennonite (Olędrzy) in Poland

A common way that northwestern European paternal lines arrived in Poland (especially along the Vistula) involves the Dutch or Frisian Mennonite communities, commonly referred to in Polish as Olędrzy (sometimes spelled “Olendrzy”). In the 16th century, Dutch and Frisian Anabaptists came to the Polish–Lithuanian Commonwealth, seeking religious tolerance and farmland. They established thriving agricultural villages in areas prone to flooding, especially along the Vistula River basin, near Włocławek and broader Pomerania (northwestern Poland).

The Anabaptist movement emerged in the early 16th century during the broader Protestant Reformation in Europe. Opponents used the term “Anabaptist” (from the Greek ana, meaning “again”) to label those who “re-baptized” adults who had already been baptized as infants in Catholic or Protestant churches. Anabaptists themselves often referred to their communities simply as “Brethren.” 
Many Anabaptist groups stress a clear division between the church and broader secular society. This principle can manifest in simple living, distinct clothing, and avoidance of civic or military entanglements. Many Anabaptists embrace pacifist teachings and refuse to bear arms. Early Anabaptists generally taught that Christians should not participate in warfare or violence of any kind. Modern denominations, such as the Mennonites and Amish, still uphold pacifist doctrines.

Viking-Age Wolin, Poland: a melting pot theory

Wolin (Jomsborg) History:
During the early Middle Ages (roughly the 8th–11th centuries), Wolin was an important trading and cultural hub on the southern Baltic coast. Various sources, including archaeological findings, indicate a diverse population—Slavs, Vikings (often Danish), and possibly other Germanic groups like Frisians or Saxons converged there for trade, crafts, and maritime activities.

Join the Discussion


If you belong to this subclade and know more about your ancestors’ place of origin, feel free to reach out or join our dedicated Facebook group:

R1b1b2a1a1d1 Group

It’s a space for sharing genealogical discoveries, discussing family histories, and helping one another understand how these deep paternal roots shape our broader heritage.


Note: Genetic genealogy is an ever-evolving field. For the most accurate, up-to-date information, consult recognized DNA testing databases, participate in ongoing studies, or connect with specialized researchers.






As an Amazon Associate I earn from qualifying purchases.

Haplogroup H6a1


I just found out that I belong to haplogroup H6a1

My mothers ancestors lived in region of Kasina Wielka, southern Poland for at least 6 generations.

If you belong to this haplogroup, please write me about where your ancestors lived and I will put it on the Google Map.


Haplogroup H6a1:
http://maps.google.com/maps/ms?ie=UTF&msa=0&msid=212651556238973909980.0004af568b0817362d00f



As an Amazon Associate I earn from qualifying purchases.

My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Amazon link

Popular Recent Articles