Tuesday 19 April 2011

ScrollView and LinearLayout programmatically scrolling

Dear Developer,
Some times you want to go away of android xml GUIs to create android GUIs using JAVA code,
This code help you in creating a LinearLayout and put it in ScrollView to easily scroll to any added View,
This is a Snapshot

This code is inside the activity


    private LinearLayout m_LinLayout;
    private ScrollView m_Scroll;
    private ImageView m_Img,m_Img2,m_Img3,m_Img4,m_Img5,m_Img6;
    private TextView m_TxtCol;

    @Override
protected void onCreate(Bundle savedInstanceState)
    {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);


m_LinLayout = new LinearLayout(this);
m_LinLayout.setOrientation(LinearLayout.VERTICAL);

/////////////////////////////////////////////////////////////////
// Add an image etc etc
m_Img = new ImageView(this);
m_Img.setImageResource(R.drawable.juices);
m_Img.setPadding(5, 5, 0, 0);

m_Img2 = new ImageView(this);
m_Img2.setImageResource(R.drawable.baba);
m_Img2.setPadding(5, 5, 0, 0);

m_Img3 = new ImageView(this);
m_Img3.setImageResource(R.drawable.fhish);
m_Img3.setPadding(5, 5, 0, 0);

m_Img4 = new ImageView(this);
m_Img4.setImageResource(R.drawable.magloopi);
m_Img4.setPadding(5, 5, 0, 0);

m_Img5 = new ImageView(this);
m_Img5.setImageResource(R.drawable.pastry);
m_Img5.setPadding(5, 5, 0, 0);

m_Img6 = new ImageView(this);
m_Img6.setImageResource(R.drawable.sapanekh);
m_Img6.setPadding(5, 5, 0, 0);

m_TxtCol = new TextView(this);
m_TxtCol.setText("Text comes here.");
m_TxtCol.setPadding(15, 5, 0, 0);
m_TxtCol.setTextColor(Color.parseColor("#FF0000"));
// You can create other controls as well.

m_LinLayout.addView( m_Img,
new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.WRAP_CONTENT) );
m_LinLayout.addView( m_Img2,
new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.WRAP_CONTENT) );
m_LinLayout.addView( m_Img3,
new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.WRAP_CONTENT) );
m_LinLayout.addView( m_Img4,
new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.WRAP_CONTENT) );
m_LinLayout.addView( m_Img5,
new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.WRAP_CONTENT) );
m_LinLayout.addView( m_Img6,
new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.WRAP_CONTENT) );

m_LinLayout.addView( m_TxtCol,
new LayoutParams(LayoutParams.FILL_PARENT,
        LayoutParams.WRAP_CONTENT) );
// If you have other controls, you should add them here.

m_Scroll = new ScrollView(this);
m_Scroll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                                 LayoutParams.FILL_PARENT));
m_Scroll.addView( m_LinLayout, new
LayoutParams(LayoutParams.FILL_PARENT,
    LayoutParams.FILL_PARENT) );

// addContentView(m_Scroll, new LayoutParams(LayoutParams.FILL_PARENT,
// LayoutParams.WRAP_CONTENT));

setContentView(m_Scroll);
}
I hope this is complete help

    

the user data image is used by another emulator. aborting


how to solve error “emulator: ERROR: the user data image is used by another emulator. aborting”. When we run android emulator tools via eclipse sometime we get this error. After i search all around the net there is look like no other option than do this step to solve the problem.
1. Go to where we put the emulator running configuration. in my case “c:\document and settings\<username>\.android\avd\<device>
2. delete this two directory “userdata-qemu.img” and cache.img
3. Re run your emulator via eclipse, this will launch new emulator

The Best Solution is Restart Your Emulator 
Hope this post will help you that have same problem with me.

Sunday 10 April 2011

Blackberry Development Using NetBeans

Requirements

Before you begin, you need to install the following software on your computer:
  • NetBeans 6.1
  • RIM BlackBerry Java Development Environment (JDE) v4.5

Setting Up for BlackBerry Development

To set up your NetBeans IDE for Blackberry development, you need to add the Blackberry JDE as a custom platform emulator because there are utilities distributed with the JDE that are not distributed with its emulators.
To do this, you perform three steps:
  1. Add the RIM Blackberry JDE as a custom emulator
  2. Create a Blackberry project
  3. Set the Blackberry as the default device emulator

Adding the RIM Blackberry JDE as a Custom Emulator

To begin, you must register the RIM Blackberry emulator using the Java Platform Manager:
  1. Select Tools > Java Platform Manager from the top navigation bar.
  2. Click the Add Platform button.
  3. Select Custom Java Micro Edition Platform Emulator. Click Next.
  4. The Platform Home should be JDE installation directory (C:\Program Files\Research In Motion\BlackBerry JDE 4.5.0).
  5. You can enter whatever you want for the Platform Name.
  6. Set Device Name to one of the supported devices: 8300, 8800
  7. Keep the Preverify Command as it is.
  8. Modify the Execution and Debugger Commands as shown:
    • Execution Command: cmd /C "cd /D {platformhome}{/}simulator&{device}"
    • Debugger Command: cmd /C "cd /D {platformhome}{/}bin&jdwp"
Click Next.
  1. The Bootstrap Libraries panel displays a long list of jar files. Select all of the listed files except net_rim_api.jar and click Remove. Click Next.
    Note: If the net_rim_api.jar is not in the list, Click the Add button, and type in or navigate to C:\Program Files\Research In Motion\blackberry JDE 4.5.0\lib\net_rim_api.jar and click Open.
    Then click Next.
  2. In the Sources and JavaDoc panel, click the Add button next to the JavaDoc window and type in or navigate to: C:\Program Files\Research In Motion\BlackBerry JDE 4.5.0\docs\api\. The Java Platform Manager should look like the following graphic:










Creating a Blackberry Project

Next, you create a project for your application:
  1. Choose File > New Project.
  2. Under Categories, choose Mobile. Under Projects, choose Mobile Application. click Next.
  3. Give the project a name, for example MobileApplication1.
    If you do not want a sample MIDlet created for your project, uncheck the "Create Hello MIDlet" check box.




  1. Click Finish to create the Project.




  1. Select the Files Tab in the Explorer window and open the project's build.xml file. Add this fragment of code right before the </project> tag at the bottom of the file:

    <target name="pre-jar">
        <available file="${platform.home}/bin/rapc.exe" property="do.rapc"/>
        <condition property="jpda.port" value="8000">
            <isset property="do.rapc"/>
        </condition>
    </target>
    <target name="post-jar" if="do.rapc">
        <exec dir="${platform.home}/simulator" executable="${platform.home}/bin/rapc.exe" failonerror="true">
            <arg value="import=${platform.bootclasspath}"/>
            <arg value="codename=${name}"/>
            <arg value="-midlet"/>
            <arg value="jad=${basedir}/${dist.dir}/${dist.jad}"/>
            <arg value="${basedir}/${dist.dir}/${dist.jar}"/>
        </exec>
    </target>
    <target name="post-clean">
        <delete failonerror="false">
            <fileset dir="${platform.home}/simulator">
                <include name="**/${name}.*"/>
            </fileset>
        </delete>
    </target>




  1. Next you need to create an .alx file which is a Blackberry 'Application Loader' xml file, in the 'Files' pane, right-click and select 'new' > 'empty file'
    Name the file the same as your application (eg. myApp.alx), and add this xml data [important - only use numerics in the version number, any letters can cause issues for OTA installing of the application when you're done, for example do not use any 'beta' version notifiers like b1.0

 <loader version="1.0">

  <application id="BlackBerry">

               <name>

                  Black Berry

               </name>

               <description>

               </description>

               <version>

                     1.0

               </version>

               <vendor>

                    Mohammad Abu Hmead

               <vendor>

                <copyright>

                     Copyright © Mohammad Abu Hmead 2011

                </copyright>

                <fileset Java=1.25>

                    <directory></directory>

                    <files>

                       BlackBerry.cod

                    <files>

                </fileset>

   </application>

</loader>

Set the Blackberry as the Default Device Emulator

Now you're ready to set the default configuration to emulate a Blackberry device:
  1. Right-click on the project and choose Properties.
  2. In the Platform Properties:
    • Choose Blackberry 4.5 from the Emulator Platform drop-down menu.
    • Choose the Blackberry device emulator from the Device drop-down menu.





At this point, you are ready to write code, build, run, execute, and debug your MIDlet for the BlackBerry.
In your project, you still have the freedom to use various platforms for different project configurations. You can work around the limitation of one device per one custom platform by repeating the steps in Adding RIM as a Custom Emulator with an alternative platform name.

Reference:
http://jonathanhfisher.co.uk/newsitems/blackberrynetbeansdev/index.htm
http://www.netbeans.org/kb/55/blackberry.html

Java Platform Manager dialog with commands edited

Adding LWUIT documentations and library to netbeans


This article to show you how to add LWUIT library to Netbeans libraries and to attach it’s documentation:
1 - Rename your lwuit library to it’s version in small letter and without space (ex:lwuit1.3.jar).

2- Compress lwuit documentations in zip archive with the same lwuit library name (ex: lwuit1.3.zip).

3- Place lwuit library in this url : c:\Program Files\NetBeans 6.9\mobility\modules.

4- Place lwuit library documentations in this url : c:\Program Files\NetBeans 6.9\mobility\modules\docs.

5-Tab on Tools in netbeans select Libraries, Press on new library button, type yor lwuit library name press ok.

6-Tab Classpath and press on add Jar/Folder point on your lwuit 
library which you placed in c:\Program Files\NetBeans 6.9\mobility\modules
7-Tab Javadoc and press on add Jar/Folder point on your lwuit library documentations which you placed in c:\Program Files\NetBeans 6.9\mobility\modules\docs

8-Press OK and use the library in your project and see the documentations folded when you write code from the library.

Kind Regards,
Mohammad Abu Hmead,
Mobile Applications Developer

An Introduction to Color Theory


The interaction of colors in a design through complementation, contrast, and vibrancy.

Complementation

Complementation refers to the way we see colors in terms of their relationships with other colors. When colors occupy opposite ends of the color spectrum, they lead people to consider a design visually appealing by establishing a happy medium the eye can reside in. Rather than straining to accommodate for a particular area of the color spectrum, the eye is provided a balance. There are two common uses of complementation: the Triadic and Compound color scheme that we will be discussing later. Complementation can take you to new heights of design sophistication when you can begin to master the intricacies of color combinations.

Contrast

Contrast reduces eyestrain and focuses user attention by clearly dividing elements on a page. The most apparent example of contrast is an effective selection of background and text color, as shown below:
Color Theory for Web DesignersColor Theory for Web DesignersColor Theory for Web DesignersColor Theory for Web Designers
If you’re ever in doubt, the best practice is usually to choose a very light color for the background, and a very dark color for the text itself. This is one area where color theory is crucial to the usability of a web design; In most projects, large text areas aren’t a place to try to be really creative – so keep it simple and legible.
Along with establishing readable text, contrast can also draw the viewer’s attention towards specific elements of a page. Think about highlighting a textbook: when you want to draw your attention to a specific portion of the page, you make the surrounding area look different than the rest of the text. The same principle applies to Web Design: Using a variety of contrasting colors can help focus the viewer’s attention on specific page elements.
If your website has a dark background, focus on the main content with a lighter color.
Color Theory for Web DesignersColor Theory for Web Designers
This principle also applies to Analogous colors (which we will discuss later):
Color Theory for Web Designers

Vibrancy

Not to sound silly, but vibrancy dictates the emotion of your design. Brighter colors lead the user to feel more energetic as a result of your design, which is particularly effective when you are trying to advertise a product or invoke an emotional response. Darker shades relax the user, allowing their mind to focus on other things. A great example of this is a comparison between CNN and Ars Technica:
Color Theory for Web Designers
CNN’s website features a stark red banner across the top, which leads to heightened emotions from users as they are stimulated by the vibrancy of the design (and the contrast between red, white, and black- the primary color scheme of the website).Color Theory for Web Designers
Ars Technica utilizes a darker color scheme for its background and header to relax the user and focus their attention towards their content. By doing so, their technical and detailed writing is considered the forefront of the site. And more importantly, the user is allowed to transfer the mental energy traditionally reserved for responding to vibrant colors to understanding the article’s contents.

How Do I Select an Effective Color Scheme?

Here are 3 of the commonly accepted structures for a good color scheme: triadic, compound, and analogous:

Triadic Color Scheme

Color Theory for Web Designers
Composed of 3 colors on separate ends of the color spectrum. There is a very easy way to create a Triadic color scheme:
  1. Take a color wheel, and choose your base color.
  2. Draw an Equilateral Triangle from this point.
  3. The three points of the triangle will form your tri-color scheme.
By using an Equilateral Triangle, you can ensure the colors have equal vibrancy and compliment each other properly.

Compound Color Scheme (aka Split Complimentary)

Color Theory for Web Designers
The Compound color scheme is based on providing a range of Complementary Colors: two colors are chosen from opposite ends of the color spectrum. By doing so, the designer is allowed more freedom in their design while also benefiting from the visual appeal of complementary colors.

Analogous

Color Theory for Web Designers
An Analogous color scheme is based on a careful selection of colors in the same area of the color spectrum. Usually the colors are differentiated by their vibrancy, and their contrast when compared to each other.
Two examples of an Analogous color scheme are:
  1. Shades Yellow and Orange
  2. A Monochromatic Selection (Shades of a base color)

Just the Beginning…

The beauty of where we are in history right now is that we can benefit from centuries of scientific and artistic color theorists. There are entire volumes that have been written about the minutia of color theory, so I’ll encourage those of you who really want to dig deep into the subject to find one of the numerous academic books available to harness some of the deeper concepts. We’ll also be releasing deeper articles on “color theory for web designers” in the future here on Webdesigntuts+ :) .
Now let’s look at some great tools that you can use to experiment on your own:

Ways to Make Your Life Easier

Thankfully, there are a few tools at our disposal that make color selection extremely easy when utilized properly. And best of all, they will further our understanding of Color Theory.
By experimenting in a guided environment, we are able to learn how to apply these principles without becoming frustrated when things are not working perfectly. Think of these tools as a sort of “color theory safety net”, to help you explore your own creativity without ever needing to stray far from the established rules for pleasing color combinations.

Kuler

Color Theory for Web Designers
A tool developed by Adobe, Kuler is aimed at providing an intuitive way to create a color palette. Every color on the palette can be individually modified, or chosen as the base color, with a few simple clicks. Palettes can be saved and published, and there are a number of great community entries available on their site. Under each color, the export codes are provided (including hexadecimal). However, the interface can be cumbersome at times, adjusting the vibrancy of a specific color can alter the entire palette (I wish they had a “lock” feature which prevented other colors from shifting). Overall, I would recommend this tool for those with a decent grasp of the concepts and patience for when things don’t run as smoothly as they would hope.

Color Scheme Designer 3

Color Theory for Web Designers
This tool is quickly becoming my preferred choice for absolute beginners, those with little patience, or people on a deadline. By providing a very simple and controlled selector, Color Scheme Designer provides a very low barrier of entry, and its choice of color principles present a variety of options. While it doesn’t teach its users why the colors work well together (Kuler’s dynamic color wheel is much more effective in that regard), its results are great as a starting point or to finish a prototype.
Its more advanced options are very useful: features such as the ability to adjust an entire palette’s saturation and contrast, color blind overlays, and sample website previews are things I hope Kuler implements very soon. However, I feel this tool shouldn’t be the primary tool used by those who want to learn Color Theory- as it does too much of the work for the user and does not allow them to intuitively experiment while maintaining the basics of each color principle.
Yes, there are lots and lots of other sites where you can find great color schemes… and we’ll actually be rounding these sites up and analyzing them in the near future (search the site for our resource roundups when it comes out).

Case Study: Gamers With Jobs

To finish this article, let’s examine a website using some of the principles that we’ve discussed. Gamers with Jobs is a website devoted to a higher analysis of videogames, through its features, podcast, and forum.
Color Theory for Web Designers
  • The grey page background with the white content background focuses the user’s attention towards the center of the website.
  • The dark bar across the page (usually reserved for advertising) “frames” the user’s view into the content.
  • The use of orange-red in the headers draws the user to the categories, feature titles, and aspects of the website.
  • The neutral color scheme provides enough visual stimulation to keep the audience interested, while still allowing them enough mental freedom to enjoy the site’s content.

Closing Remarks and Summary

One of the hardest aspects of working with colors is that sometimes when colors have not yet been arranged in a design, they do not appear to work well together. However, once they are applied, their visual harmony usually becomes apparent. I’ve caused myself a fair amount of frustration by adjusting the colors chosen in Kuler before applying them to a design, only to find that the color scheme was altered just enough to be unappealing.
Trust in the theory! Apply the colors chosen through a color principle, and then adjust as needed. Doing so will save you a lot of time, and strengthen your design skills as you’ll begin to see color in more refined, artistic, and even scientific ways!

Summary

  • Choosing colors on opposite ends of the spectrum creates a visual harmony for the eyes.
  • A high contrast between elements makes text easily readable, and guides your reader’s attention.
  • The brighter the colors, the more mental energy they will consume.
  • Don’t be afraid to use tools such as Kuler and Color Scheme Designer 3, they only make your life easier and prevent you from becoming frustrated with the learning process.
Thank you for reading my first article, I had a ton of fun writing it. Please provide some feedback in the comments section if you feel so inclined, I want to make these articles as useful as possible.
Oh! And if you’re eager to read more, check out another great theory-based article that relates to what we just talked about: “Understanding Visual Hierarchy in Web Design”

Mobile Key Codes : J2ME


KEY_NUM0,KEY_NUM1,              The number keys from
 KEY_NUM2, KEY_NUM3,                    0 to 9 on the
KEY_NUM4, KEY_NUM5,                   keypad
KEY_NUM6, KEY_NUM7,
KEY_NUM8, KEY_NUM9
KEY_STAR    The * key
KEY_POUND   The # key
-1          The scroll-up key
-2          The scroll-down key
-3          The scroll-left key
-4          The scroll-right key
-5          The Select key or the middle soft key
-6          The left soft key (available on Canvas with no                     Command)
-7          The right soft key (available on Canvas with                      no Command)
-8          The Clear key
-50         The Shift or Edit key
-10         The Send key
-11         The End key (may not be available if it causes                    the MIDlet to exit)
-12         The Voice key
10          The Enter key in full keyboard
32          The Space key in full keyboard
8           The Backspace key in full keyboard
27          The Escape key in full keyboard
9           The Tab key in full keyboard
127         The Delete key in full keyboard
Character Unicode: Alphabetic keys on full keyboard. For example, the A key maps to Unicode 0x0061, or 0x0041 if the shift key is held down.

Mobile Apps

The mobile apps are likes appetizers, you can't use thew mobile just for dialing and or for listening  to music. You wan't to play game, to read something, to chat, to browse internet, to contact with social networks. These are why the mobile applications take there way to the top.
Your mobile all the time with you, and easy to carry, and charged all time, so, you can browse your email without opening your laptop. the only thing you want is accessing the internet, and it solved by 3G.

So Computers step by step will be replaced by Mobiles.