Skip to main content

Posts

Audio in Android& MediaPlayer

  MainActivity.java <code> package com.example.myapplication; import androidx.appcompat.app. AppCompatActivity; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate( savedInstanceState); setContentView(R.layout. activi ty_main ); try { Uri uri = Uri. parse ( " https:// freetestdata.com/wp-content/ uploads/2021/09/Free_Test_ Data_100KB_OGG.ogg " ); MediaPlayer player = new MediaPlayer(); player.setAudioStreamType( AudioManager. STREAM_MUSIC ); player.setDataSource( this ,uri) ; player.prepare(); player.start(); } catch (Exception e) { ...
Recent posts

Busy Coder's Guide to Android Development

Source Code https://commonsware.com/Android/previews/defining-and-using-styles About the Book The Busy Coder's Guide to Android Development  is a book covering Android application development, from basics through advanced capabilities. It is updated several times a year and is available through  the Warescription  program. Subscribers also have access to office hours chats and other benefits. This repository contains the source code for the hundreds of sample apps profiled in the book. These samples are updated as the book is, with  git  tags applied to tie sample code versions to book versions. The book, and the samples, were written by Mark Murphy. You may also have run into him through Stack Overflow: About the Code All of the source code in this archive is licensed under the Apache 2.0 license except as noted. The names of the top-level directories roughly correspond to a shortened form of the chapter titles. Since chapter numbers change w...