public void onClick(View v) { // Get the text out of the view String text = mTextView.getText().toString(); // convert it using the function defined above. See the docs for // android.os.Vibrator for more info about the format of this array long[] pattern = MorseCodeConverter.pattern(text); // Start the vibration Vibrator vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(pattern, -1); } };
public void onClick(View v) { // Get the text out of the view String text = mTextView.getText().toString(); // convert it using the function defined above. See the docs for // android.os.Vibrator for more info about the format of this array long[] pattern = MorseCodeConverter.pattern(text); // Start the vibration Vibrator vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(pattern, -1); } };
@SmallTest public void testCharacterS() throws Exception { long[] expectedBeeps = { MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT}; long[] beeps = MorseCodeConverter.pattern('s'); assertArraysEqual(expectedBeeps, beeps); }
@SmallTest public void testCharacterS() throws Exception { long[] expectedBeeps = { MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT}; long[] beeps = MorseCodeConverter.pattern('s'); assertArraysEqual(expectedBeeps, beeps); }