Code example for InvalidParameterException

     *   dont use VOICE_RECOGNITION_REQUEST_CODE, this is reserved for the other constructor 
    public VoiceInputAssistant(ImageButton voiceButton, int requestCode) {
        if (requestCode == VOICE_RECOGNITION_REQUEST_CODE)
            throw new InvalidParameterException("You have to specify a unique requestCode for this VoiceInputAssistant!");
        this.requestCode = requestCode;
     * Creates a new VoiceInputAssistance-instance for use with a specified button and textfield. 
     * If you need more than one microphone-button on a given fragment, use the other constructor. 
     * @param activity the activity which holds the microphone-buttone and the textField to insert recognized test 
     * @param voiceButton the microphone-Button 
     * @param textField the textfield that should get the resulttext 
    public VoiceInputAssistant(Activity activity, ImageButton voiceButton) {
        Assert.assertNotNull("Each VoiceInputAssistant must be bound to a activity!", activity);
        Assert.assertNotNull("A VoiceInputAssistant without a voiceButton makes no sense!", voiceButton);
Stop searching for code, let great code find you!  Add Codota to your java IDE