Saturday, 14 May 2011

Tuesday, 3 May 2011

Embedding Flash File in Website


<html>
<h1>
Embedding Flash File in Website 
</h1>

<body>
<object height="400" width="600">
<param name="movie" value="FlashFileName.swf">
<embed src="FlashFileName.swf" height="400" width="600"></embed>
</object>
</body>
</html>

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