Android : How To Display RGB 565 Byte Array On Screen?
Apr 27, 2009Can please anyone let me know how to display a raw RGB 565 byte array on the screen.
View 2 RepliesCan please anyone let me know how to display a raw RGB 565 byte array on the screen.
View 2 RepliesI have Picture data in byte rgb_565 array, and I want convert it in a productive way into argb array. Right now I have found only one (little slow) way to do this: Bitmap mPhotoPicture = BitmapFactory.decodeByteArray(imageData, 0 , imageData.length);
where imageData is my byte[] array in rgb_565, and then: int pixels[] = new int[CameraView.PICTURE_HEIGHT*CameraView.PICTURE_WIDTH]; mPhotoPicture.getPixels(pixels, 0,PICTURE_WIDTH, 0, 0, PICTURE_WIDTH, PICTURE_HEIGHT);
The point is I believe creating a Bitmap object is exacting and not necessary in this case. Is there any other faster way to convert rgb_565 array into argb array? I need this because making image processing on rgb_565 array seems to be a little annoying. Or maybe it is not so hard?
I am trying to make an application that would be able to send the user's voice over the network using RTP. I am using the ported stack from hsc (JLIBRTP) and I am able to record user's voice in a saperate thread. the problem is that jlibrtp uses has a class named RTPSession that is responsible for the session and has the sendData method that takes a byte [] as argument and the AudioFormat class I am using to record user's voice is in AudioFormat.ENCODING_PCM_16BIT wich is short. I have tried using 8bit audioformat but I get an illigalargument exception in my htc magic and in my emulator. So is there any way I can convert the short [] to byte [] ? would that be acceptable in order of voice quality?, is the above error a known bug for htc magic or the platform doesn't support 8bit audio format?
View 3 Replies View RelatedI would like to get a byte array from an jpeg image located in my res/drawable file?
View 3 Replies View RelatedI want to store image in sqlite database. I tried to store it using BLOB and String, in both cases it store the image and can retrieve it but when i convert it to Bitmap using BitmapFactory.decodeByteArray(...) it return null. Below is my code please have a look and suggest me where i m making mistake.
View 3 Replies View RelatedDoes anyone know how to convert a bitmap to a byte array?
View 2 Replies View RelatedIs it possible to create a byte array from bitmap?How can I do so?
View 3 Replies View RelatedI want to store pictures from the internet in my data base as byte arrays. I get the pictures as bitmaps, but can't find way to convert it to byte array.
View 4 Replies View RelatedIm trying to convert a byte array which is in Base64 format to String as below. Data was not assigned properly to the String. Do I need to pass the encoding type while creating the new String?
View 3 Replies View RelatedIn most tutorials is how to display only one of them, I noticed to display an array, main class should use interface from ListActivity, but when i try display something else (like my edittext box) program crashes.
Somebody suggest me To display an array like that:
ArrayAdapter<String> myAdaptor = new ArrayAdapter<String>(this,R.layout.test,myStrings); myListView.setAdapter(myAdaptor);
but this is not doing anything.
Can anyone tell Me what is wrong in this lines or explain me how to solve my problem?
I try to send an image over bluetooth to another device. This works mostly fine, but sometimes, I get a StreamCorruptedException: Wrong format: 0x27 on the receiving device. Anybody knows what this means? And how can I avoid that?
View 1 Replies View RelatedI ask if there is a simple way because there is a google issue report saying that using decodeByteArray isn't possible. But that report originated in 2008 and I was hoping there was a solution not posted on there. The method listed on the issue report was to decode the format yourself, but I'd prefer to not have to put that in and slow down the program.
View 1 Replies View RelatedI have to convert a byte array to string in Android, but my byte array contains negative values. If I convert that string again to byte array, values I am getting are different from original byte array values. What can I do to get proper conversion?
View 7 Replies View RelatedI'm using the following code to encrypt a String (inText) whose output is a byte array named cipherText;
Code:
byte[] cipherText;
cipherText=cipher.doFinal(inText.getBytes());
The cipherText is printed in a textbox as follows:
Code:
encText.setText(new String(cipherText));
Everything works fine until here. However, in the decryption section, I need to get the contents of the textbox as a byte array again. For this purpose, I use the following code:
Code:
byte[] cText;
cText=encText.getText().toString().getBytes();
When I try to do the encryption it gives a 'bad size' error. I found out that the lenghts of the two byte arrays cipherText and cText aren't equal:
Code:
decText.setText(Integer.toString(cText.length));
encText.setText(Integer.toString(cipherText.length));
boolean res=Arrays.equals(cText, cipherText);
result.setText(Boolean.toString(res));
The 'result' textbox always prints 'false' meaning that the two byte arrays cipherText and cText aren't equal. However I convert cipherText to a String to print in a textbox and then read the contents of that textbox, convert to String back and then to Byte Aray again. Obviously some data is lost during these conversions.
Please could anyone suggest an approach for transferring a >2MB video from a ContentResolver into a Bytestream, without running out of memory?
See question: http://stackoverflow.com/questions/2599305/android-outofmemoryerror-w...
Here's the current code, which throws an OutOfMemoryError on the byteBuffer.write(buffer, 0, len) line when transferring large videos:
// get bytestream to upload videoByteArray = getBytesFromFile(cR, fileUriString);
public static byte[] getBytesFromFile(ContentResolver cR, String fileUriString) throws IOException { Uri tempuri = Uri.parse(fileUriString);
InputStream is = cR.openInputStream(tempuri);
byte[] b3 = readBytes(is); is.close(); return b3;
}
How do I store and retrieve a byte array (image data) to and from a SQLite database in Android?
View 1 Replies View Relatedi want to add the current string in a textview view to a string array in arrays.xml.then display the last/previous string of that array in a textview (setText).
View 1 Replies View RelatedHow can I display a particular array of items from a database (SQLServer) in a Spinner of Android?
View 2 Replies View RelatedI have an xml layout file which contains a few widgets including a Spinner
I want to display a list of strings in the spinner, the list is generated at runtime as a result of a function so it can not be in arrays.xml.
I tried doing:
CODE:...........
But this crashes my application.
Is there a way to convert JSON Array to normal Java Array for android ListView data binding?
View 2 Replies View RelatedI'm new to android developing but right now I'm working on an application that displays Random Facts. Since I don't want it to be in a random order, I would like to have them in a list. I would like to order through them one by one and show them using TextView.
Resources res = getResources();
myString = res.getStringArray(R.array.FactsArray);
That's what I have so far. If I'm right, that just establishes the array so I can be able to use it later. What I had before was rgenerator which chose a random string from the array and displayed it when I clicked a button.
CODE:................
But Like I said, I would like to just order through them one by one when a button is clicked.
Is there a simple way to convert a JsonArray to a standard Java Array? Obviously, you can iterate and do it explicitly, but I wanted to see if there was a direct way to do so.
View 2 Replies View RelatedIn my android application i need to insert an array into an array and access its values. Is there any way that i can get this done.
View 3 Replies View RelatedI am dealing with http post method on Android. I have successfully send simple string pairs using HttpClient and HttpPost class with the NameValuePair as entity. However now I want to send a simple array of bytes[]. Unfortunately the only entities I have found for the HttpPost class are the NameValuePair and FileEntity. However my byte[] is not from a file. Wirting it to a file and then sending by the FileEntity seems to be pointless and stupid. How can I send this array using default HttpClient and HttpPost class?
View 3 Replies View RelatedI just want to read <string-array> resource elements into a String array. I don't want to make a view or anything and mess with adapters - just want to transfer the elements. Is there a built in class for this? Or do I need to treat the resource file as a regular file?
View 3 Replies View RelatedI'm trying to draw an image downloaded from the web but keep getting the error "Cannot cast from Bitmap to byte[]". Here's the code...
View 7 Replies View RelatedHow do I create a Bitmap from a byte[]?
View 2 Replies View RelatedI am currently sending and receiving SIP messages across a network. When I want to add SDP data to a SIP message I use the SessionDescription object in jrtp. This object is then added to the SIP message. But when I get a SIP message from the server its SDP is in a byte[] array. So I'm wondering is there anyway to convert the byte[] back into a SessionDescription object so I can use the SessionDescription object's methods to parse the data?
View 1 Replies View RelatedWe are trying to access bytes in non-sequential order from a 'content:' URI that we receive in the intent from other applications. Is there a way to do this, without buffering the bytes within the application?
We found a discussion about the same from 2008 at: http://groups.google.com/group/android-developers/msg/49a1b7d651d4707e Is it possible now?
I want to store this array in to SQLite database.Can some one give me code for converting this array in to byte[] or give me code for another solution ?
View 1 Replies View Related