MIDPアプリを作成している初心者です。 Image データを一旦端末のレコードストアに保存しておく為、 getRGB()で取得したint配列を、byte配列に変換しなくてはいけません。 ↓のように レコードストアに書き込むメソッドを書いてみました。 public void writeRecordStore( String name, Image image ) { int width = image.getWidth(); int height = image.getHeight(); int[] pxData = new int[ width*height ]; byte[] byteData; RecordStore rs = null; try { //画像をバイトデータに変換 image.getRGB( pxData, 0, width, 0, 0, width, height ); //レコードストアを開く rs = RecordStore.openRecordStore( name, true ); //バイト配列に変換 ← ここがわからない //レコードの追加 rs.addRecord( byteData, 0, byteData.length ); } catch( Exception e ) { } } int配列をbyte配列に変換する方法わかる方 ご教授の程お願いします。 また、まだコーディングに自信が無いので、文法のミスもご指摘頂けたらありがたいです。
↧