[android-developers] Re: Request to official ADC2 team.

2009-09-21 Thread Salt

+

On 9月15日, 午前3:40, Mobidev android.mobi...@gmail.com wrote:
 .               Once upon a time, we had this little 
 group…http://groups.google.com/group/android-challengeAndroid Challenge:
 Discuss the Android Developer Challenge, including questions on
 contest details. You can also seek other developers to join a team
 effort.
                …then came this 
 message…http://groups.google.com/group/android-challenge/browse_thread/thread...
                …and the group was closed for ever.

 A humble request toADC2team to officially start and moderate a newADC2group 
 similar to the previous android-challenge group.ADC2
 messages are scattered in android-developers and android-discuss
 groups.ADC2discussions does not fit in either of these groups. There
 will be hundreds of queries, comments, news and PR pitches once 
 theADC2judging app goes live. So please could you start aADC2
 discussion group at the earliest.

 Thanks.
 P.S. Droids of the planet please vote with '+' or '–' for this
 request.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] BufferedReader problem

2009-07-12 Thread Salt

Hi all,

I encountered the problem that the BufferedReader causes garbled
characters when I read UTF-8 file.
I confirmed that this problem occurred on both Emulator(1.5) and ADP1
(1.5).

I posted same message into Japanese community.
http://groups.google.com/group/android-group-japan/browse_thread/
thread/8cdb21ac8e1210fc
They said this problem didn't occur on Linux JavaVM (based on UTF-8)
with almost the same code as this, but occurred on Android Emulator.

Does anyone know workaround?



Test code:

public class TestBufferedReader extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

//vv

// Make text file in Japanese
String strFullPathName = /data/data/ + getPackageName() + /
test.txt;
makeFile(strFullPathName);

// Test reading and writing text file
testReadWrite(strFullPathName);

//^^
}


//vv

// Make text file in Japanease
public void makeFile(String strFullPathName) {
File fileOut = new File(strFullPathName);
fileOut.getParentFile().mkdirs();

FileWriter fw = null;
BufferedWriter bw = null;

try {
fw = new FileWriter(fileOut);
bw = new BufferedWriter(fw);

String str = あいうえおかきくけこ;//
abcdefghijklmnopqrstuvwxyz; is OK. but Japanese/Chinese characters
cause problem.
for (int i = 0; i  4000; ++i) {
bw.write(str);
bw.newLine();
}
}
catch (IOException ioe) {
ioe.printStackTrace();
}
finally {
if (bw != null) {
try {
bw.close();
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

// Test reading and writing text file
public void testReadWrite(String strFullPathName) {

// input
File fileIn = new File(strFullPathName);
FileReader fr = null;
BufferedReader br = null;

// output
File fileOut = new File(strFullPathName + .tmp);
FileWriter fw = null;
BufferedWriter bw = null;

try {
fr = new FileReader(fileIn);
br = new BufferedReader(fr);// If the buffer size is
specified, frequency of the problem falls.

fw = new FileWriter(fileOut);
bw = new BufferedWriter(fw);

int nLine = 0;
String str;
while ((str = br.readLine()) != null) {
++nLine;
if (str.indexOf('\uFFFD') = 0) {   // If the garble
happens, it is converted into '\uFFFD'.
Log.e(test, read error! at line  +
Integer.toString(nLine));
}

bw.write(str);
bw.newLine();
}
}
catch (IOException ioe) {
ioe.printStackTrace();
}
finally {
if (br != null) {
try {
br.close();
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}

if (bw != null) {
try {
bw.close();
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

//^^
}



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---