How to convert the object Bitmap to byteArray.

Hi all

I had a problem in the conversion of the bitmap object to. BMP file.

(Real need: capture the screen shot and convert that turned to the screen.) BMP image and I have to keep this image in the SCARD

I shouldn't use any PNGEncodedImage or JPEGEncodedImage )

I capture the screen shot using the

Bitmap BM = new Bitmap (width, height);

Display.screenshot (WB);

to get the data from [] bytes of this bitmap object that I use

Byte [] _bytes = getBytesFromBitmap (bitmap);

public byte [] getBytesFromBitmap (Bitmap bmp) {}
try {}
int height = bmp.getHeight ();
int width = bmp.getWidth ();
int [] rgbdata = new int [width * height];
ByteArrayOutputStream Bos = new ByteArrayOutputStream();
DataOutputStream back = new DataOutputStream (bos);
Graphics g = new Graphics (bmp);
bmp.getARGB(rgbdata,0,width,0,0,width,height);
for (int i = 0; i)< rgbdata.length="" ;="" i++)="">
If (rgbdata [i]! = - 1) {}
dos.writeInt (i);
back. Flush();
//l++;
}
}
Bos.Flush ();
Return bos.toByteArray ();
}
catch (Exception ex) {}
Dialog.Alert ("getBytesFromBitmap:" + ex.toString ());
Returns a null value.
}

If I use this byte array in the Sub statement I get the "IllegalArgumentException".

BMPEncodedImage.createEncodedImage (_bytes, 0, _bytes .length);

all can help me how I can get the byte [] data from the bitmap object?

import java.io.ByteArrayOutputStream;import java.io.DataOutputStream;import java.io.IOException;

import javax.microedition.lcdui.Image;

/** * @author Samuel Halliday */public final class BMPGenerator {

    /**     * @param image     * @return     * @throws IOException     * @see {@link #encodeBMP(int[], int, int)}     */    public static byte[] encodeBMP(Image image) throws IOException {        int width = image.getWidth();        int height = image.getHeight();        int[] rgb = new int[height * width];        image.getRGB(rgb, 0, width, 0, 0, width, height);        return encodeBMP(rgb, width, height);    }

    /**     * A self-contained BMP generator, which takes a byte array (without any unusual     * offsets) extracted from an {@link Image}. The target platform is J2ME. You may     * wish to use the convenience method {@link #encodeBMP(Image)} instead of this.     * 

* A BMP file consists of 4 parts:- *

    *
  • header
  • *
  • information header
  • *
  • optional palette
  • *
  • image data
  • *
* At this time only 24 bit uncompressed BMPs with Windows V3 headers can be created. * Future releases may become much more space-efficient, but will most likely be * ditched in favour of a PNG generator. * * @param rgb * @param width * @param height * @return * @throws IOException * @see http://en.wikipedia.org/wiki/Windows_bitmap */ public static byte[] encodeBMP(int[] rgb, int width, int height) throws IOException { int pad = (4 - (width % 4)) % 4; // the size of the BMP file in bytes int size = 14 + 40 + height * (pad + width * 3); ByteArrayOutputStream bytes = new ByteArrayOutputStream(size); DataOutputStream stream = new DataOutputStream(bytes); // HEADER // the magic number used to identify the BMP file: 0x42 0x4D stream.writeByte(0x42); stream.writeByte(0x4D); stream.writeInt(swapEndian(size)); // reserved stream.writeInt(0); // the offset, i.e. starting address of the bitmap data stream.writeInt(swapEndian(14 + 40)); // INFORMATION HEADER (Windows V3 header) // the size of this header (40 bytes) stream.writeInt(swapEndian(40)); // the bitmap width in pixels (signed integer). stream.writeInt(swapEndian(width)); // the bitmap height in pixels (signed integer). stream.writeInt(swapEndian(height)); // the number of colour planes being used. Must be set to 1. stream.writeShort(swapEndian((short) 1)); // the number of bits per pixel, which is the colour depth of the image. stream.writeShort(swapEndian((short) 24)); // the compression method being used. stream.writeInt(0); // image size. The size of the raw bitmap data. 0 is valid for uncompressed. stream.writeInt(0); // the horizontal resolution of the image. (pixel per meter, signed integer) stream.writeInt(0); // the vertical resolution of the image. (pixel per meter, signed integer) stream.writeInt(0); // the number of colours in the colour palette, or 0 to default to 2n. stream.writeInt(0); // the number of important colours used, or 0 when every colour is important; // generally ignored. stream.writeInt(0); // PALETTE // none for 24 bit depth // IMAGE DATA // starting in the bottom left, working right and then up // a series of 3 bytes per pixel in the order B G R. for (int j = height - 1; j >= 0; j--) { for (int i = 0; i < width; i++) { int val = rgb[i + width * j]; stream.writeByte(val & 0x000000FF); stream.writeByte((val >>> 8 ) & 0x000000FF); stream.writeByte((val >>> 16) & 0x000000FF); } // number of bytes in each row must be padded to multiple of 4 for (int i = 0; i < pad; i++) { stream.writeByte(0); } } byte[] out = bytes.toByteArray(); bytes.close(); // quick consistency check if (out.length != size) throw new RuntimeException("bad math"); return out; } /** * Swap the Endian-ness of a 32 bit integer. * * @param value * @return */ private static int swapEndian(int value) { int b1 = value & 0xff; int b2 = (value >> 8 ) & 0xff; int b3 = (value >> 16) & 0xff; int b4 = (value >> 24) & 0xff; return b1 << 24 | b2 << 16 | b3 << 8 | b4 << 0; } /** * Swap the Endian-ness of a 16 bit integer. * * @param value * @return */ private static short swapEndian(short value) { int b1 = value & 0xff; int b2 = (value >> 8 ) & 0xff; return (short) (b1 << 8 | b2 << 0); } } Found form the Link mentioned below:
http://javablog.co.uk/2007/12/26/j2me-bitmap-encoder/

Tags: BlackBerry Developers

Similar Questions

  • How to convert the column of ROW using DBMS_REDIFINITION object type column

    Hi all
    Suppose I have the following table to convert:
    create table customer as select customer_id cid, cust_first_name name, cust_address street from customers;
    alter table customer modify cid primary key;
    I created the table based on the customers of the OE schema table, while the street column has cust_address_typ with the following attribute object type
    SQL> describe cust_address_typ
     Name                                     Null?     Type
     ----------------------------------------------------- -------- ------------------------------------
     STREET_ADDRESS                               VARCHAR2(40)
     POSTAL_CODE                                   VARCHAR2(10)
     CITY                                        VARCHAR2(30)
     STATE_PROVINCE                               VARCHAR2(10)
     COUNTRY_ID                                   CHAR(2)
    I want to convert the object attribute adresse_rue in a column of RDM. Consider the following temporary table:
    CREATE TABLE INT_CUSTOMER(
    CID NUMBER,
    NAME VARCHAR2(30),
    street varchar2(100)
    );
    First of all, I checked if the table can be redefined:
    --Verify if the table can be redefined
    BEGIN
    DBMS_REDEFINITION.CAN_REDEF_TABLE('OE','CUSTOMER',DBMS_REDEFINITION.CONS_USE_PK);
    END;
     4  /
    
    PL/SQL procedure successfully completed.
    But when I started the redefinition, I got an error:
    BEGIN
    DBMS_REDEFINITION.START_REDEF_TABLE(
    uname => 'OE',
    orig_table => 'CUSTOMER',
    int_table => 'INT_CUSTOMER',
    col_mapping => 'CID CID, NAME NAME, STREET CUST_ADDRESS_TYP(STREET_ADDRESS)'
    );
    END;
      9  /
    BEGIN
    *
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected
    ORA-06512: at "SYS.DBMS_REDEFINITION", line 52
    ORA-06512: at "SYS.DBMS_REDEFINITION", line 1646
    ORA-06512: at line 2
    What seemed to be the problem?

    Best regards
    Val

    Published by: Valerie good-natured October 9, 2011 21:43

    Have you tried this one:

    BEGIN
    DBMS_REDEFINITION.START_REDEF_TABLE(
    uname => 'OE',
    orig_table => 'CUSTOMER',
    int_table => 'INT_CUSTOMER',
    col_mapping => 'CID CID, NAME NAME,"CUSTOMER".STREET.STREET_ADDRESS STREET'
    );
    END;
    

    Looking at your trace file, I claim that when you use the call above to START_REDEF_TABLE, the inner workings of this procedure will create this SQL statement:

    select CID CID, NAME NAME,"CUSTOMER".STREET.STREET_ADDRESS STREET from "OE"."CUSTOMER" "CUSTOMER"
    

    (You can prove or disprove my claim by tracing it ;-)))

    And this statement has had an alias - even if the alias is the same as the name of the table...

  • How to convert the following code in as3?

    As the title says... How to convert the following code to as3?... Thanks in advance.

    import flash.display.BitmapData;

    linkageId = "landscape";
    myBitmapData = BitmapData.loadBitmap (linkageId);


    MC = this.createEmptyMovieClip ("mc", 1);
    mc.attachBitmap (myBitmapData, 1);

    onMouseMove = function() {}
    myNewColor = "0 x" + myBitmapData.getPixel(_xmouse,_ymouse).toString (16);
    newColor.setRGB (myNewColor);
    selectedColor.colorValue.text = myNewColor;
    }
    selectedColor.swapDepths (_root.getNextHighestDepth ());
    newColor = new Color (selectedColor.sample);

    :

    var myBitmapData:landscape = new landscape (0,0);

    var bmp:Bitmap = new Bitmap (myBitmapData);
    addChild (bmp);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, f);

    function f(e:MouseEvent):void {}
    var myNewColor:String = "0 x" + myBitmapData.getPixel(mouseX,mouseY).toString (16);
    newColorTransform.color = uint (myNewColor);
    selectedColor.sample.transform.colorTransform = newColorTransform;
    selectedColor.colorValue.text = myNewColor;
    }
    addChild (selectedColor);
    var newColorTransform:ColorTransform = selectedColor.sample.transform.colorTransform;

  • How to convert ObjectProxy object [no one can answer this question?  :(]

    Hello

    Calling a web service with the resultFormat value e4x. When I get the result, it is in XML format. What I need is to convert it to a custom type, object of value (which is actually a class generated from WSDL). I couldn't find a way to do this. So I used a SimpleXMLDecoder to decode for a generic object. Now my problem is that all objects nested inside this generic object are of type 'ObjectProxy '. So I can't convert them my nested valuables.

    So now I finally need is one of the 2 following things:

    1. a way to convert the ObjectProxy to my custom type value object.

    Or

    2. a way to directly analyze the XML result to my type of Custom value object.

    Please let me know if I need to provide some details.

    Help, please... This one is really kill me now...

    Thanks in advance!

    I know the poster original for that matter will probably not get it, but it is not the intention of this post... I just spent the last 6 hours trying to find the answer to the question: How do I convert an ObjectProxy to my object?

    Well here is the answer for any other googlers who find this post (as it is on the first page of results for "objectproxy object cast")

    Let's say you have a service call which returns a generic object type.  "In the SOAP, you might see the xml tag resulting as.  In flex, it almost always will convert this to an ObjectProxy class.  You will find that out the object isn't exactly simple and cast to the desired type is also is no more.

    Here's how you do it, and it's actually VERY simple once you know what you need to do:

    First of all, you must convert the ObjectProxy in an object type.  To do this, you must use the namespace "object_proxy" itself.  Here's the code to do

    Import mx.utils.ObjectProxy;

    Import mx.utils.object_proxy;

    var myObjectProxy:ObjectProxy = new ObjectProxy (myStronglyTypedObject);

    var obj:Object = myObjectProxy.object_proxy::object;

    This code there will be 'myObjectProxy' and pull on the original object in a general object variable (NOTE: the reference to object is read only according to the docs.)  It is only half the battle though, as at the time, you still need to throw your object to return.  I've read in several sources that you can use a method "as MyType" to convert the object from there, but I couldn't get this to work.  Traditional molding (i.e. MyType (obj)) leads to a runtime error as well.  They can work for you if call proxy your object from an existing flex object, but will NOT work if you tire of an ObjectProxy response service.  Either way, however, the solution is just shorter to type in the case that you he shot of an intervention of service call:

    import com.adobe.serializers.utility.TypeUtility;

    obj = com.adobe.serializers.utility.TypeUtility.convertToStrongType (obj, MyType);

    (if you are unable to access this method, you should probably add the serializers.swc of the framework to your build path:)

    Adobe Flash Builder 4.5 root Directory\eclipse\plugins\com.adobe.flexbuilder.project_4.5.1.313231\dcradSwcs\4.5\libs\s erializers.swc

    This will convert your object to the type you want it to be.

    AND YOUR DONE.  No more looking for people to answer full and not more to convert your service calls to e4x instead.

    Now, if you want to know why it works but casting is not sticking around... If you don't like it, don't waste your time to read the rest of the present:

    Why that your other service calls can analyze data from a response xml SOAP at any predefined by the SOAP service, but casting this type proxy version does not work?

    Your service calls are generated dynamically from the SOAP data, then of course flex "just don't know" how to do... and your SOAP objects do not extend the object class... so what gives?

    If you look at the web service generated dynamically in flex code, you will see that each service call says what should be the result type.  Then the whole AbstractOperation (your client-side web service class) is given a convertResultHandler function that retrieves the data from the result and converts the type defined by the service.  You will not get very far just look at the code if it's away from the abstract.  But if you look at the code of serializers.swc update (you'll have to decompile it) will give you an idea of what it is that makes handler function.  Basically, this handler function takes and checks whether it is an ArrayCollection/table collection or an object and then differs from conversion of the object/table to separate the functions called 'convertToStrongType' and 'convertListToStrongType '.  These functions take a class in your object, convert it and return the past of conversion class.  Bingo.

    Now, you'll see that you can take this object and use the functions convertToStrongType and convertListToStrongType with the EFA serializers to run the conversions you need.  The advantage of this is that these functions are the SAME FUNCTIONS ACCURATE who manage the conversion of your objects in the webservice result, so you can pretty much bet that you will lose all the data like you would with reflection level unique and such utilities.

    As a side of the usefulness of this note.  If you have a c# return of web service which returns a type of list object, which means you can run in all kinds of different items in the same list, then you can use this in conjunction with a mark of the object function to determine the object type to perform conversions.

    I REALLY hope this helps some other people to save themselves from pulling their hair or lose whole days trying to figure the answer before moving on to some power of the wall facility that will make your code more complex!

  • How to convert the precision extended float to float in C++

    Hello

    Could someone me please how to convert the extended precision (floatExt) float normal float in C++?

    What is the difference in the float between Labview and C++ data type?

    When I tried to receive a range of float of a function of the DLL generated by Labview in C++, data are bad.

    Thank you

    Victor King

    You can search for numeric data types in LabVIEW help for more information on the different types of data. Before sending the data to the C++ application, you can use the function of Double precision on digital / range of Conversion to convert number to Double precision.

  • How to convert the date in milliseconds?

    Hi all

    Can I know how to convert the date in milliseconds?

    My current datetime like this Formate

    QDateTime::currentDateTime (m:System.NET.SocketAddress.ToString ("MMMM dd, yyyy HH"))

    Seconds since January 1, 1970

    http://Qt-project.org/doc/Qt-4.8/QDateTime.html#toTime_t

    Sinds milliseconds January 1, 1970

    http://Qt-project.org/doc/Qt-4.8/QDateTime.html#toMSecsSinceEpoch

  • Please how to convert the photo to the second

    2012-Kia-Rio-SX-side1.jpg11707850_10153403835594354_514303523436587694_n-1.jpg

    Please guys how to convert the kia rio pictures the second perfect like this, and with any program, I know that all steps in details please its very important

    That looks just like you would use the tool pen to redraw on the image and create shape layers (black areas). It could be done in Photoshop or Illustrator.

    Using Photoshop | Draw with the pen tools

  • Hello, I have a full desktop in Adobe Muse, site and I want to convert it into a version Tablet &amp; phone, then, how would convert the site Office to Tablet &amp; phone to copy the entire office content and site structure? Thanks for any help.

    Hello, I have a full desktop in Adobe Muse, site and I want to convert it into a version Tablet & phone, then, how would convert the site Office to Tablet & phone to copy the entire office content and site structure? Thanks for any help.

    You can not automatically convert. Click on the "tablet" or "Phone" at the top of your plan view to create these versions.

    You can then copy and paste on any content you want has more of your office.

  • How to create the object rectangular box with a pure action script.

    How to create the object rectangular box with a pure action script?

    I think, it can be done through the clip library, but I'm not sure. Please, I want to take the suggestion to create a rectangular box as a script through

    Take a new file and write about the first image the code below, it works fine:

    var rect = new Shape();
    rect.graphics.beginFill (0xFF0000);
    rect.graphics.drawRect (0, 0, 100,50);
    rect.graphics.endFill ();

    var MC = new MovieClip();
    mc.addChild (rect);
    addChild (mc);

    If this doesn't solve your problem then paste the error you get

  • DW cannot convert the &lt; object &gt; tag created with swfObject 2

    I have a Flash video on an "integrated" static html page using the swfObject method 2. When I open the page in DW CS3 I get this error message:

    "This page contains < object > tags that may not work properly in the most recent versions of Internet Explorer. DM cannot convert the < object > tag. »

    Page plays the video the two local system on the server.

    this test page is here: http://www.rjdutton.com/about_movSWF2.html

    Relevant source code is:

    --> < object classid =... etc and

    --> < object type =

    Since this is the only code on the test page that refers to an object tag.

    The on-board Flash I have on the website (home page and the who we are page) now are incorporated using < embed > via Flash CS3 (AC_Run active content), but this method does not validate. the swfObject method 2 valid.

    I'm working on a Mac. Could someone check the page on the victory of the IE and see if the video is running?

    Can I ignore the message 'error' of Dreamweaver?

    Thanks - Susan

    I think that you will have no problem ignoring the message.

    Ken Ford
    Adobe Community Expert - Dreamweaver/ColdFusion
    Adobe Certified Expert - Dreamweaver CS3
    Adobe Certified Expert - ColdFusion 8
    Fordwebs, LLC
    http://www.fordwebs.com
    http://www.cfnoob.com

  • Convert the object to arraycollections

    I read in the forums when you return an XML element, Flex does not return the XML in a table but rather an object. I tried to put returnFormat = "array" in line with HTTPService but also to convert the object into a table according to 'getPhotoList' the use of this: event.result.gallery.photo = ArrayUtil.toArray (event.result.gallery.photo);

    I managed using both methods, suggestions?

    "< mx:HTTPService id ="photoListRequest"url =" ' list.php? type = customerImage "result =" getPhotoList (event) "method ="POST">
    < mx:request xmlns = "" >
    < user_id > {user_id} < / user_id >
    < / mx:request >
    < / mx:HTTPService >
    < mx:Script >
    <! [CDATA]
    [Bindable] private var fileXMLList:ArrayCollection;
    private void getPhotoList(event:ResultEvent):void {}
    photoXMLList = event.result.gallery.photo;
    }
    []] >
    < / mx:Script >

    Brad,

    Here is the solution that I found:

    private void getPhotoList(event:ResultEvent):void {}
    try {}
    photoXMLList = event.result.gallery.photo;
    }
    {catch(e:Error)})
    photoXMLList = new ArrayCollection();
    photoXMLList.addItem (event.result.gallery.photo);
    }
    }

  • How to convert the hierarchical query of SQL Server (CTE) to Oracle?

    How to convert the hierarchical query of SQL Server (CTE) to Oracle?

    WITH cte (col1, col2) AS
    (
    SELECT col1, col2
    FROM dbo. [tb1]
    WHERE col1 = 12
    UNION ALL
    SELECT c.col1, c.col2
    FROM dbo. [tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
    )
    DELETE one
    FROM dbo. [tb1] AS an INNER JOIN b cte
    ON a.col1 = b.col1

    Hello
    Something like this maybe:

    DELETE FROM dbo.tb1 a
     WHERE EXISTS (
      SELECT 1
        FROM dbo.tb1 b
      WHERE a.co11 = b.col1
          AND a.col2 = b.col2
       START WITH b.col1 = 12
      CONNECT BY b.col2 = PRIOR b.col1)
    

    Although you need to do here is to check that CONNECT it BY SELECT, returns records you wait first, then the DELETION should work too.

  • How to convert the Bitmap Image in BlackBerry

    Hello

    In my application, I get the picture from the server. Now, I want to convert this Bitmap Image to display on the screen. For this I use below codes. But it doesn't give me the same image does not mean with the clarity and the exact size. He's smaller than the picture.

    I used the codes below:

    private Bitmap getBitmapFromImg(Image img) {
            Bitmap bmp = null;
            try {
                Logger.out(TAG, "It is inside the the image conversion        " +img);
                Image image = Image.createImage(img);
                byte[] data = BMPGenerator.encodeBMP(image);
                Logger.out(TAG, "It is inside the the image conversion---333333333"+data);
                bmp = Bitmap.createBitmapFromBytes(data, 0, data.length, 1);
                } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return bmp;
            // TODO Auto-generated method stub
        }
    

    Here is the BMPGenerator class:

    public final class BMPGenerator {
    
            /**
             * @param image
             * @return
             * @throws IOException
             * @see {@link #encodeBMP(int[], int, int)}
             */
            public static byte[] encodeBMP(Image image) throws IOException {
                    int width = image.getWidth();
                    int height = image.getHeight();
                    int[] rgb = new int[height * width];
                    image.getRGB(rgb, 0, width, 0, 0, width, height);
                    return encodeBMP(rgb, width, height);
            }
    
            /**
             * A self-contained BMP generator, which takes a byte array (without any unusual
             * offsets) extracted from an {@link Image}. The target platform is J2ME. You may
             * wish to use the convenience method {@link #encodeBMP(Image)} instead of this.
             * 

    * A BMP file consists of 4 parts:- *

      *
    • header
    • *
    • information header
    • *
    • optional palette
    • *
    • image data
    • *
    * At this time only 24 bit uncompressed BMPs with Windows V3 headers can be created. * Future releases may become much more space-efficient, but will most likely be * ditched in favour of a PNG generator. * * @param rgb * @param width * @param height * @return * @throws IOException * @see http://en.wikipedia.org/wiki/Windows_bitmap */ public static byte[] encodeBMP(int[] rgb, int width, int height) throws IOException { int pad = (4 - (width % 4)) % 4; // the size of the BMP file in bytes int size = 14 + 40 + height * (pad + width * 3); ByteArrayOutputStream bytes = new ByteArrayOutputStream(size); DataOutputStream stream = new DataOutputStream(bytes); // HEADER // the magic number used to identify the BMP file: 0x42 0x4D stream.writeByte(0x42); stream.writeByte(0x4D); stream.writeInt(swapEndian(size)); // reserved stream.writeInt(0); // the offset, i.e. starting address of the bitmap data stream.writeInt(swapEndian(14 + 40)); // INFORMATION HEADER (Windows V3 header) // the size of this header (40 bytes) stream.writeInt(swapEndian(40)); // the bitmap width in pixels (signed integer). stream.writeInt(swapEndian(width)); // the bitmap height in pixels (signed integer). stream.writeInt(swapEndian(height)); // the number of colour planes being used. Must be set to 1. stream.writeShort(swapEndian((short) 1)); // the number of bits per pixel, which is the colour depth of the image. stream.writeShort(swapEndian((short) 24)); // the compression method being used. stream.writeInt(0); // image size. The size of the raw bitmap data. 0 is valid for uncompressed. stream.writeInt(0); // the horizontal resolution of the image. (pixel per meter, signed integer) stream.writeInt(0); // the vertical resolution of the image. (pixel per meter, signed integer) stream.writeInt(0); // the number of colours in the colour palette, or 0 to default to 2n. stream.writeInt(0); // the number of important colours used, or 0 when every colour is important; // generally ignored. stream.writeInt(0); // PALETTE // none for 24 bit depth // IMAGE DATA // starting in the bottom left, working right and then up // a series of 3 bytes per pixel in the order B G R. for (int j = height - 1; j >= 0; j--) { for (int i = 0; i < width; i++) { int val = rgb[i + width * j]; stream.writeByte(val & 0x000000FF); stream.writeByte((val >>> 8) & 0x000000FF); stream.writeByte((val >>> 16) & 0x000000FF); } // number of bytes in each row must be padded to multiple of 4 for (int i = 0; i < pad; i++) { stream.writeByte(0); } } byte[] out = bytes.toByteArray(); bytes.close(); // quick consistency check if (out.length != size) throw new RuntimeException("bad math"); return out; } /** * Swap the Endian-ness of a 32 bit integer. * * @param value * @return */ private static int swapEndian(int value) { int b1 = value & 0xff; int b2 = (value >> 8) & 0xff; int b3 = (value >> 16) & 0xff; int b4 = (value >> 24) & 0xff; return b1 << 24 | b2 << 16 | b3 << 8 | b4 << 0; } /** * Swap the Endian-ness of a 16 bit integer. * * @param value * @return */ private static short swapEndian(short value) { int b1 = value & 0xff; int b2 = (value >> 8) & 0xff; return (short) (b1 << 8 | b2 << 0); }

    Where an error in my code? Is there another way to do the same thing?

    Why you want to use a bmp image?
    You can just use png, jpg or whatever of the original image is.
    If there is a situation where you need the bitmap image call http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/EncodedImage.html#getBi...

  • How to convert the old sync key (12 characters, no dashes) to the new sync key (31 characters, 5 dashes)?

    My sync key was of 12 characters, no dashes (xxxxxxxxxxxx). After uninstalling and reinstalling FF 3.6.13, Sync 1.6.1 refuses my sync key to 12 characters.
    I discovered, that the keys of synchronization for all users have been activated to 31 characters including 5 dashes (x-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx). How can I get the new key for synchronization?
    I have no PC connected to Firefox Sync more but Firefox Home and 360 browser on my iPhone successfully sync. Unfortunately on the iPhone I can't display the sync currently used key. Is there a way to convert the old key to sync to the new?
    I need the bookmarks saved in my sync account.
    Thanks for your help!

    I had the same exact symptoms as you did. Here is my solution:
    I installed an older version of firefox sync (1.4.something, I think) and then added my account using my old short firefox sync key. When you try to synchronize, the out of date addon says to do synchronization, it must be updated. After update, I always signed, but now had the additional device to see my new long firefox sync key that was compatible with FF 4 b, etc. Everything works fine now and my computer is properly synchronize.

  • How to convert the substring to waveform

    Hello

    I have an input file with a lot of numbers that need to be converted to a waveform. I used the match model vi to extract the data I need to be traced out. These data can be seen in 'before the substring"but I do not know how to convert these data to waveform. Can anyone help? I have attached the input file and the vi as well. Thank you

    Try using the worksheet File.vi reading. It converts a text file delimited by tab characters in a table of numbers in one step.

    Lynn

Maybe you are looking for