Portrait and Landscape Layouts

While you are developing your mobile application, you always have to think in the user side, and how your application will provide fast and quality results (those could be data, screens, services, etc) for the user. Not only think in HOW, but envision if is going to be that effectively. Now we got the point. One factor that always influences users of the way they see a game or an application is the way of the screen is disposed.

When you are developing your application, Android framework make it easy for you. You just do your application, and when the cellphone go to landscape, is a different the way you have thought. And everything could be changed of place, it would be not aligned as you designed and a headache just starts.

I will show will, a little application and the way it behaves in Portrait and Landscape. And a way to define your Landscape as you wish.

Here, we have a simple application, a Temperature Converter:

Here. The Layout is set up to Vertical. At this point no problem. But when you turn to landscape, it follows what you have done.

You could this using LinerLayout, TableLayout whichever you want is fine.

Here, I just used the LinearLayout.





See. It just followed what you have set up for the application.

However if you wish to be different in portrait, or landscape, what do you do?






Here we have all the packages that are created when you just created the project.

You see the layout/main.xml , right?

So we should add another layout, the landscape layout to have a “dedicated” layout to landscape. How do we do that? simple!!

So, just create a folder called layout-land to define

your layout and create the main.xml inside.

This main.xml, could be totally different, you could

include more features as well.

But if you want just change the layout to other way

you think is better for the user, you do it.




Here, just a new Landscape layout:

If you noticed, the TextView is different, and the way that components are disposed on the screen too.

Here, I just used other type of Layout, the TableLayout.

This means, you can do your own screens in different ways, or use different resources/components to cause a better impression and usability for the user.

Some mobile applications have better view in Portrait, while others have better view in Landscape. It means, depend of the goal of the application. What it is going to show to the user and if what is being shown is the best way to do it. Sometimes, the way the components are disposed is the key, though. Facilitate the view to the user is always welcome. As I said, it could vary from the simplest application to the most complex.

Android !

What’s up!!!

Did you know what is Android?

If you are a beginner you can start here, if you have notions about programming and android you check here out.

I would say Android is not only a Operating System for mobile devices, but with many frameworks and applications involved in it, we could call it a software stack. This Stack is composed by Frameworks, applications (e.g: Browser, Caller, games, etc),  Virtual Machine (The Dalvik),  mobile devices features (Camera, 3G, EDGE, Touch Screen, GSM or CDMA TEchnology, bluetooth, Wifi, GPS, accelerometer, etc) and in addition a development kit for developers. The SDK for developing and debugging . And the great point in all of this, it is free. An OPEN DEVELOPMENT PLATFORM.

Many companies are adhering Android in their phones like Motorola, HTC, Sony Ericsson, Samsung, etc…

IF you want to start in android world you will need 4 basic things. Eclipse IDE, where you are going to develop android apps, your own apps. Sun’s Java Development Kit, The JDK The Android Software Developer’s Kit (SDK) and the Android developer tool (ADT), the plugin for eclipse (this last one you can download and install by eclipse).

First, Download All those 3 software. Then Install the JDK (whether you do not have it installed).

Download Eclipse and the Android SDK.  If you running on Windows both are going to be zip files. Extract them separated, each one in its folder for example:  C:\eclipse and C:\android. It is just up to you.

One step for windows, you have to edit your Enviromnet Variables and add the C:\android\tools to it.  How? simple.

Right click on My Computer and go to properties. There find the System Properties and then Advanced System settings (or in WinXP just the tab Advanced). The in the second box you look for a variable called path. Click on it and edit it. In the end add the address of android tools. If you have followed my example would be C:\android\tools . This is necessary to make it easier to launch Android tools.

Ok. Time to start Eclipse. Just open it.

Go to Help -> Install New Software

Now click in Add, and then add the android address :

In the Locations you can type: https://dl-ssl.google.com/android/eclipse . Click OK.

The Developer tools will appear. check check it and click on NEXT.

You have to accept the terms of the license and then click Finish.

Restart eclipse.

If you do not get a warning about the plugins are not installed (if yes just install all) go to the Window -> Preferences and then Android as the pic bellow shows



Here you have to add the Android path to eclipse recognize the android API.

When you do that you already can start a New Android Project. But when I do a application I should see a cellphone screen and see my application running in it, right? yeah. So, is it already set up? Let’s check if everything is ok!

Go to Window -> Android SDK and AVD Manager ; Here you will see the packges and the Virtual Device (what would be the cellphone). First Check the packges. If they are not installed, check them and just click install. After that Go back to the Virtual Devices to create a new AVD (Android Virtual Device).  Click New. Then type the name of the AVD, I suggest ” my_avd”. You have to choose a target. The target is the API that you are going to use in your AVD. We could see as Android versions.

Select the version that you want and click “Create AVD”.

Ok. After you Configure the Android development environment is time to start.

Go to File -> New -> Project ; Click in Android Project

Look the image bellow:

First, you have to name your project. We could start with a HelloWorld.

Second, choose the Android API in the list Build Target. There, you will see many Android “versions” and choose any you want to start your project. I recommend you choose the same as you have chose when you configured your AVD.


Then you have 4 fields in blank.

The first one is the application Name. It has to have a name. HelloWolrd.

The name, you will see in the Android menu. The name of your application.

The Second one, the package.  Your application have to be in a package. And the name of this one has to have at least two identifiers. E.G:  android.helloworld or firstapp.android. It is just up to you what name it.

The last, that you need to fill out is the Activity.

—–  Brief explanation  —–

The Android Application is composed by four components. There components are defined by Android architecture.

Activities, Services, Broadcast and Intent Receivers and Content Providers. This post I will talk about the Activities. In the future I will talk about the others. But if you want to read about them, just check this link.

When you create an Android application, your application always have to has an activity. Even a “HelloWorld!”  has one. Activities are that chunk of code running in time. For example, Screens; Each activity shows one screen to the user. If one Activity is not being used, or not actively running the operating system can kills it, so it can conserve more memory.


So, the name of the activity is HelloWorldActivity .

Then click on Finish.

Ok. Now you just started an Android Project. You have your first application ready to run.

Before you run it. Let’s take a look at what we have.

In the src (the source) folder, we have the package that you name it as you wanted.

I just named blog.helloworld . And bellow this directory we the gen folder. It is where you will find the R.java .That is all resources from res directory in Java.

Then we can see the Android library. If you click on it, you will all jars that composes the android library that you have chose before during the project creation.

As a resource, you could have any images, bitmaps, or whatever you need for your application.

The layout tells android how dispose items, things on the screen when applications runs. You can check it out, and you will see a XML file.

Values are outside the source. You can use them anytime. What is this? Values are constants, strings, etc..

At last, we have the manifest. The manifest a XML file too. This file defines all components in your application and tell Android about all components that exists in your application.  So, it learn and know about all components in your application before build it.

Now, go to the strings.xml file. And just edit the line that you see HelloWorld. This is going to be the output. You can see in the next line. The name of your application.

Right click on the project and then click on Run As -> Android Application

Pan, Pan Pan Paaaannn!!!

Now the your application is going to run in the emulator, the AVD that you have created.

The Java is going to start too.

You will see that the emulator is like a virtual machine.  So you will see a cellphone on your screen. Just go the menu and find your application and click on it. It will start to running and congrats, you made your first Android App!!

Feelings, hopes and plans

I always wanted come to U.S., visiting, meeting new people, culture, language and here I am!
I am not good with the words, but I`ll try to explain and write what I feel and happen.
And I already felt this feeling, when I get my fist big trip in Brazil, from Sao Paulo to Porto Alegre. What I wanna to say is, I went to different places, meet different people,etc.. So the feeling to discovering a new place is here again, however I am discovering a new world, totally different, my mind is gowning up, expanding and new people, new places, new culture, mainly, is changing, I mean, evolving my thoughts, way to think and see the world.
In the moment I think I get many feelings in different times and in the same time all together, because this is new, is good, is fantastic!
I was not believing that I was,really, coming here! And in Brazil I just not faced what was happening, because I just realized all when I arrived at Bloomington-Normal.
Even I have been in Atlanta, I could not believe that this could be true! Because sounds like an awesome thing! I could never been here if in the past I got chosen another things, but the choices that I had in my way brought me here.
Sincerely, I don`t know what I hope, because everything here is better than I thought or imagined. The people and contact are being nice, the culture and another thing to look the things makes me to thing that it all works very well like jobs, studies, law, services (health, education, life, housing, etc).
With my goals my plans walks side by side. First I am going to finish this semester I am expect to be the best student of class or one of those, because I ave to do my best, not only here, but everywhere every time! And my target it is to take awesome classes in the next semester, like android, Java mobile and Math. Doing this i hope to improve my skills in English`s language and to learn new things in I.T. or programing area.
After all this, I think, I am going to Brazil, finish my College,  get a good job where I like to do like programing or something like that.
Stay working in Brazil while, and would like to return to U.S. and study again, but take a Master Degree or even, who knows, a PHD.
Once in the college in Brazil, some friends and me tried to open a business, but in Brazil it is so hard and expensive do that and the idea just was kept in the mind! But get a pretty good job or open my own business is my main goal in the next near future.

to start Apache at Ubuntu

Always when I turn on pc pc, boot in ubuntu 10.04 all of services that I need and I use are loaded automatically…

So, some day ago this could not happen anymore… better, this it was not working anymore…

I use often apache server service to my web applications … and one day it was not working..

I will show you what I did …

I opened the Terminal and typed:


its show to you all proccess are running in yout machine and its features like pid, time, name, etc..

I did not see the apache there..

I just looked for apache and started it:

from there the apache server service start to work at your pc…

if you are using windows you hace probally xamp, amp or whatever you need to set up and do that every time you want to use it.. or set up to start when you pc is turning on….

On Ubuntu it starts automatically … so, if you miss apache in yout pc, try this…

Ubuntu, network interface and problens

I was very upset today, at the moment.
My ubuntu, more precisely the gnome, messed the whole network interface and now I can no longer get access to wired connection…
It seems any more windows viruses than a problem for gnome / ubuntu.
hooooooowever, I’ll show what I tried to do and the procedures for configuring my network interface. Hope that helps someone, because I did not help much. only in the end I hace success.
for you to view the network interfaces on your computer:
sudo = to superuser
sudo ifconfig-a
For you to edit network interfaces:
sudo gedit / etc / network / interfaces
here you will open the file interfaces .. gedit is the editor of textual, you replace it with vi, vim, etc …
in my case I put it in the file,
# The loopback network interface
auto lo

iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192 168 143 169
or to set up direct ip do this:
sudo ifconfig eth0 netmask
remembering that eth0 is my network interface is eth0,
I thought I could set up so I went on board and was like, friends here at work said I was right,
hoooooowever, to no avail ..
Then I edited the file sudo gedit / etc / network / interfaces
and left it like this:

auto lo
iface lo inet loopback
# The primary network interface
auto eth0

ready, wired connection back to work …
why have stopped working is still a mystery ..
I’m going to find out why .. but I hope it could be help…I almost lost a day trying to find out to solve it..


Dtrace on OpenSolaris

I’ll talk a bit about …. Dtrace
That it?
A wonderful tool that has the OpenSolaris to monitor your entire system ..
How so?
DTrace is intended to monitor everything, when he said, is all the same, on your computer, what programs open (that’s already doing it or other OS software), network status, hardware, file behavior, attendance, monitor what’s Threads system are running, are in the queue, which will still be called (I want to see an OS or proprietary software to do this !!!), see what is happening in the kernel, you can see EVERYTHING in detail, as called processes, modules, functions,DWI!!
According to wikipedia “… The kernel of an operating system is understood as the core of it, or a literal translation, core. He represents the software layer closest to the hardware and is responsible for managing the resources of the computer system as a whole ….. “So if you can see what the kernel is doing through the Dtrace, you really can correct mistakes and so walk to an ideal operating system (Theoretically )!!!!
To get a better idea, the Dtrace group explains that “… DTrace is a framework created by Sun Microsystems for Solaris 10 that gives the system administrator a way understandable to monitor and track all internal operations of each process or Routine system, becoming a powerful tool for advanced diagnosis of problems or enhancements ….”
The cool thing is you monitor what they do, such as what processes you use when you start x software. What about this all you have on hand and see that performance, see problems or failures that can be repaired even by yourself.
In this link (Click Here) Sun you find a book about DTrace and a good detailed explanation of what he is and does!

To make a script to run dtrace you have to write in Language D. Yeah, that’s right, D. Language But that is not a big deal not, is quiet.
A small example from the terminal Opensolaris …
Open terminal and type

cat hello.d
#! / Usr / sbin / dtrace-s
trace (“Hello World \ n”);

Ready program is done in the / usr / sbin / dtrace-s command is to create the script
and to run the command type
dtrace-s hello.d

Here is the output!!

It is a simple example, but you can see that is not as difficult goes like only a matter of habit with the language.

So with this example and encouragement that Dtrace is the best tool for monitoring and optimization of the Solaris and OpenSolaris, just start playing!
I hope it helped and have any questions just email or post comments!

Here you can find a “How to” DTrace is a very good material for those just starting out and want to understand more about this powerful tool!
Click here to download!
And here the Potal BigAdim Sun has plenty of tips and materials!

How to install VirtualBox 3.0 on OpenSolaris

The difficult is…have more than 1 file to install…..
We, frequently see one file to install, but now we have two files.
one for interfaces like usb, boot order, cd image, it is kernel interface package…
and another only VirtualBox.
Here is the snapshot, step by step to install it. Then here we have the pkg..we are extracting it to some directory ( what you want).

We can see 4 files.
2 is .pkg, so we need it.

After you extracted you can open the terminal and go to the directory which you extrated the files.

As we can see. we have 2 files.
WE must “execute” first the VirtualBox.Kern….

pfexec pkgadd -G -d VirtualBoxKern-3.0.2-SunOS-r49928.pkg
You say “all”, to install all of it.

Now you install the second pkg,

pfexec pkgadd -G -d VirtualBox-3.0.2-SunOS-r49928.pkg

The first file is VirtualBox kernel interface package, you must install it first!!!
After you install the main VirtualBox package:
VirtualBox working!!!

This installation I did because I had no internet connection… I have a cd wich has many software to install on OpenSolaris…. but if you have internet connection I will post later how to do that in a repository from Sun… (you be registered )…

Vendo Notebook

É …. vou sentir saudades do meu companheiro, mas chegou a hora que preciso vende-lo…


Processador Core 2 duo T6600 2.Ghz.

3gb de ram. HD de 160 gb.

Bateria de 9 células(apox 4 horas).

Acompanha carregador, todos os cds de programas, drivers e inclusive windows Vista original.

Monitor 15.4.


Rede com fio.

rede sem fio placa Wireless DELL WRLS 1505 WIRELESS-N MINI-CARD.

Fones de ouvido.

Webcam 1.3 px.

Se lhe interessar pode entrar em contato comigo por aqui : renatoppuccini[at]gmail[dot]com

U.S. here we Go!!!

Na semana passada, terça- feira, saiu o resultado do programa Fulbright que oferece 50 bolsas de estudos no período de um ano para estudantes de faculdades de tecnologia. Then, here we go!!!

Em julho, mais precisamente 28, estou indo para os EUA. A terra das maiores empresas de tecnologia (Google, IBM, Apple, Intel, Sun, Oracle, etc)!!!

Depois de muito tempo de espera do resultado, ele veio, dia 11 de maio de 2010!!

Tudo começou ano passado quando fiquei sabendo do programa por um amigo da faculdade que foi contemplado com a bolsa…

Procurei saber sobre o programa oferecido pela Fulbright. ” …Trata-se de uma iniciativa inédita do governo daquele país, com o objetivo de fortalecer a formação de tecnólogos em Community Colleges, instituições norte-americanas de ensino superior focada na prática profissional….” .

Para efetuar a inscrição tive que fazer o TELP (Test of English Language Proficiency)  …. Consegui nota maior que a mínima e fiz a inscrição(toda em inglês com 4 redações ). Depois fui selecionado para a entrevista, com 2 brasileiros e 1 americano. Fiquei muito nervoso, pois nunca tinha feito nenhum curso da língua inglesa. Um tempo depois saiu o resultado e fui fazer o TOEFL.

Essa prova, já mais difícil, pois teve reading, listening, speaking e writting.

Depois disso mandei o meu histórico da faculdade para a FulBright, eles traduziram pro Inglês e mandaram para vários Community College ‘s nos EUA, que é equivalente a uma faculdade de tecnologia aqui no Brasil. Depois disso o College, analisa seu histórico e te escolhe… Vou para Heartland Community College, Normal, IL

Aí será onde vou morar por um ano… Um sonho desde criança se realizando !!!!!! Coração a mill!!

Obrigado Fulbright !!!

Obrigado também a minha família e amigos que sempre estiveram comigo!

E a DEUS e a fé que tenho !!!

Triboot – Ubuntu, OpenSolaris e Windows

Aproveitei esse post do meu blog antigo e o trouxe pra cá para mostrar como se faz um triboot com ubuntu, opensolaris e windows na maquina.

O windows já veio quando comprei o note, logo instalei o OpenSolaris, que automaticamente já faz o Dual-Boot pra você, como o Ubuntu faz quando se tem o windows já instalado.

Um problema que sempre temos é, quanto ubuntu ou solaris já estão instalados e queremos instalar um dos dois. O que ocorre é que o Grub de um substitui o Grub do outro (isso já deveria ter sido solucionado, mããs).
No link abaixo você encontra um minibook do OpenSolaris explicando como fazer o Tri-boot no pc…

Como eu já tinha o OpenSolaris instalado e depois instalei o ubuntu, fica mais fácil editar o GRUB do ubuntu.
O Ubuntu que instalei aqui é o 9.10.

Quando você vai instalar o ubuntu, ele lhe mostra (na parte de partições) quais sistemas operacionais estão no seu pc e em quais partições estão.
ex: (hd0,1)
O “hd0” indica o número da sua HD. Se você só tem uma HD então é hd0, se tiver 2 ou 3. Segunda HD é hd1 , terceira hd é hd2 e assim por diante.
E o número depois da virgula mostra a particao que o sistema está, no caso do meu exemplo a hd0 tem 3 partições…

Por ter instalado o Ubuntu por ultimo, vamos ao Grub dele localizado em /boot/grub/grub.cfg .
Nessa versão do ubuntu o arquivo do Grub está diferente, em outras versões era menu.lst, no próprio minibook do OpenSolaris acima, você obtém essa informação.

Você irá encontrar algo, mais ou menos assim:

menuentry “Ubuntu, Linux 2.6.31-14-generic” {
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,4)
search –no-floppy –fs-uuid –set aedd5635-eefd-4470-8733-5697fb9c1227
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=aedd5635-eefd-4470-8733-5697fb9c1227 ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
menuentry “Ubuntu, Linux 2.6.31-14-generic (recovery mode)” {
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,4)
search –no-floppy –fs-uuid –set aedd5635-eefd-4470-8733-5697fb9c1227
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=aedd5635-eefd-4470-8733-5697fb9c1227 ro single
initrd /boot/initrd.img-2.6.31-14-generic
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry “Memory test (memtest86+)” {
linux16 /boot/memtest86+.bin
menuentry “Memory test (memtest86+, serial console 115200)” {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry “Microsoft Windows XP Professional (on /dev/sda1)” {
insmod ntfs
set root=(hd0,1)
search –no-floppy –fs-uuid –set a848d7b248d77d8e
drivemap -s (hd0) ${root}
chainloader +1

nas linhas acima, mostra a entrada do ubuntu 9.10, e do windows, ou seja, ele não viu que o OpenSolaris estava instalado lá, então vamos adicionar o OpenSolaris depois do Windows ali, ….

menuentry “OpenSolaris 2009.06″{
set root=(hd0,2)
chainloader +1
No meu caso, o OpenSolaris está na segunda partição, tomem cuidado com isso, sabia bem onde está seu OpenSolaris, para adicionar certo no GRUb…
Lembrando que para editar esse arquivo no ubuntu você terá que ser super usuário…
Depois disso, só fechar e salvar seu Grub e reiniciar o pc, e pronto, triboot feito….

How to install OpenOffice on OpenSolaris


After we have installed the OpenSolaris Operating System, now we will install the OpenOffice…

The easier way to do this, i think… 😀

So, lets go!!!

You can download the OpenOffice clicking HERE!!!!

After you downloaded the OpenOffice, the instalation package you can open it or put in some directory in your pc …

In this tutorial that i made, i copy from cd to desktop…

I ‘ve copied to desktop and after to /export/home/renato/download… this was my preference..

You put the file where you wants…. anyway will install it… After copied you can open it the file.tar.gz and copy the directory which is inside that .tar.gz and paste where you wants.. thats directory which contains the source… you, basicly, are unzinping the file.tar.gz and taking hte directory…

Now, you can open the Terminal, wrtite su, write your root password and star to install.

Now look what i did…I entered in the directory which the is the file…
cd local of package
and now i wrote :
pkgadd -d. (dont forget the dot)

now, you will see the packages and after the question if you wants all packages..
I said “all”, to install all packages of OpenOffice ….

After this it will question you about the instalation and you say “yes” to all….
Ready.. the OpenOffice was installed….

P.S. If you download it by manager packages, it does all of it only using clicking!!
In the list of packges you search for openoffice and click to download. Automatically it is been installed…
No complications!!