@Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_audio_recording, container, false);
        audioVisualization = (AudioVisualization) view.findViewById(R.id.visualizer_view);
        btnRecord = (Button) view.findViewById(R.id.btn_record);
        return view;
    }
Fragment with visualization of audio recording.
app/src/main/java/com/cleveroad/example/AudioRecordingFragment.java