Friday, March 28, 2014

hide a component in jsf

Sometimes it happens that you want to hide some of your components so that they become invisible to users.
And you may suddenly wonder how to achieve that or which option to use. Fine, JSF makes it pretty easy for you to do that by using the rendered  option which is a boolean with either true or false.
e.g:

this component will become invisible. 

Monday, March 24, 2014

Change Orientation of an android emulator.

 Changing the orientation of your device to test your app is very essential for guaranteeing the user friendliness of your app. With a real device in your hand you just have to turn it up and down from portrait to landscape and  etc... without any issue.   But can you do the same thing when using an emulator ? 

    Just press CTRL + F11 or CTRL + F12 and discover it yourself.

           Contrary to what you may have thought before, it appears now to be pretty easy. I have tested this on windows and hopefully it will work on other OS as well, but If you do face any trouble or have a better way to handle this please as usual don't hesitate to drop a line of comment. 

 That said, stay tuned and have a nice coding day !

Setting SD Card File on your android emulator

Developing apps involving taking some photos from the camera requires the use of  SD card, but how do you set it up. Do you need to rush to the nearby hardware store to get an SD card ? Of course not, the solution just lies on few mouse clicks.
 How to set up a virtual SD card in your eclipse IDE ?  If you are using the ADT bundle you are lucky this post will likely help you out.

1. Go to SDK/tools directory :
    make sure that you have the mksdcard utility available else download SDK manager.

2. Go to the cmd and locate the mksdcard directory and your own sd card called mysdcard:
   
C:\adt-bundle-windows-x86-20130917\sdk\tools>  mksdcard.exe 62M mysdcard
   Press Enter and it is done.
 62M represents the size of your sd card file.

3. Go to the Android Virtual Device manager:

Windows --> Android Virtual Device manager

4.  Select the device and Edit:

5. Make sure you change the back camera option  to Emulated or Webcam()

6. Under SD Card:
    select the File option and browse to the location of mysdcard and select it.
  Click Ok.

7. Rebuild your project , run it and have fun

Due to the lack of time I could not provide you with screenshots but trust me I will insert them next time. If you face any problem, please don't hesitate to drop a comment.
 Aurevoir !!!

Thursday, March 20, 2014

This text field does not specify an inputType or a hint

You a scenario like the following where the text field is showing  the above warning

You omitted to declare the type of your text field.
e.g: if you are  going to enter text ,
then

And it becomes:
Done !

hardcoded string should use @string resource

Even though you can proceed without any major problem the principle of clean code recall us to get rid of all warnings at every steps. Now , suppose you have the following snippet:

Due to the following line :

[I18Nhardcoded string "Country" should use @string resource

Solution:

You have to go to your res folder and there will be a strings.xml file under values, then add the line below:


Then now under your main.xml  replace the existing textView with

Done !