I’ve copied the soft keyboard .java files into my project. I’ve got the keyboard to pop up in my view, but something tells me that i don’t need the keyboard src files directly in my project unless I want to change the keyboard. I’ve commented out some of these files and the keyboard still pops up. do you just use the keyboard like any other class that ships with android.
public void record() {
int frequency = 44100;
int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO;
int audioEncoding = AudioFormat.ENCODING_PCM_16BIT;
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/reverseme.pcm");
// Delete any previous recording.
if (file.exists())
file.delete();
// Create the new file.
try {
file.createNewFile();
} catch (Exception e) {
throw new IllegalStateException("Failed to create " + file.toString());
}
try {
// Create a DataOuputStream to write the audio data into the saved file.
os = new FileOutputStream(file);
bos = new BufferedOutputStream(os);
dos = new DataOutputStream(bos);
// Create a new AudioRecord object to record the audio.
//int bufferSize = AudioRecord.getMinBufferSize(frequency, channelConfiguration, audioEncoding);
int bufferSize = AudioRecord.getMinBufferSize(sampleRate, channelConfiguration, audioEncoding);
audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
frequency, channelConfiguration,
audioEncoding, bufferSize);
short[] buffer = new short[bufferSize];
audioRecord.startRecording();
while (isRecording) {
int bufferReadResult = audioRecord.read(buffer, 0, bufferSize);
for (int i = 0; i < bufferReadResult; i++)
dos.writeShort(buffer[i]);
}
} catch (Exception e) {
Log.e("AudioRecord","Recording Failed");
e.printStackTrace();
}
InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
im.showSoftInput(this.findViewById(R.id.editText1), InputMethodManager.SHOW_FORCED);
}
Well if you are using a EditText, The keyboard will automatically popup when you tap on it to edit.
You need not port your own version of soft qwerty
To show :
And to hide:
So i think you are on the right track.