App Development for Smart Devices. Lec #12: Audio and Video

Size: px
Start display at page:

Download "App Development for Smart Devices. Lec #12: Audio and Video"

Transcription

1 App Development for Smart Devices CS 495/595 - Fall 2011 Lec #12: Audio and Video Tamer Nadeem Dept. of Computer Science

2 Objective Playing Audio & Video Media Player Recording Audio & Video Media Recorder Taking Video, Picture, Audio Speech Recognition Presentation - Project Proposals (cont d) - Sound Sense: Scalable Sound Sensing for People-Centric Applications on Mobile Phones Presenter: Mostafa Uddin Page 2 Fall 2011 CS 495/595 - App Development for Smart Devices

3 Playing Audio & Video Page 3 Spring 2011 CS 752/852 - Wireless and Mobile Networking

4 Media Format Audio Formats: Wav (PCM uncompressed), AAC, MP3, WMA, AMR, OGG, MIDI Native: 44.1kHz 16 bit stereo Best sampling: 11kHz, 22kHz, or 44.1kHz Remember headphones Good free recording tool: audacity Video Formats: MP4 (MPEG-4 low bit rate) H.263 (3GP) H.264 (AVC) More details: Page 4 Fall 2011 CS 495/595 - App Development for Smart Devices

5 Media Player Comprehensive MediaPlayer to simplify the playback of audio and video. MediaPlayer can play media stored in application resources, local files, Content Providers, or streamed from a network URL. To play a media resource, create a new MediaPlayer instance, initialize it with a media source, and prepare it for playback. Once you ve finished playback, call mediaplayer.release() to free the associated resources. Media Player reference: Page 5 Fall 2011 CS 495/595 - App Development for Smart Devices

6 Media Player The Media Player s management of audio and video files and streams is handled as a state machine. Initialize the Media Player with media to play. Prepare the Media Player for playback. Start the playback. Pause or stop the playback prior to its completing. Playback complete. Page 6 Fall 2011 CS 495/595 - App Development for Smart Devices

7 Preparing for Audio Playback Use the static create method, passing in the application Context and one of the following: A resource identifier A URI to a local file using the file:// schema A URI to an online audio resource as a URL A URI to a local Content Provider row Context appcontext = getapplicationcontext(); MediaPlayer resourceplayer = MediaPlayer.create(appContext, R.raw.my_audio); MediaPlayer fileplayer = MediaPlayer.create(appContext, Uri.parse("file://sdcard/localfile.mp3")); MediaPlayer urlplayer = MediaPlayer.create(appContext, Uri.parse(" MediaPlayer contentplayer = MediaPlayer.create(appContext, Settings.System.DEFAULT_RINGTONE_URI); Page 7 Fall 2011 CS 495/595 - App Development for Smart Devices

8 Preparing for Audio Playback Alternatively, use the setdatasource method on an existing Media Player instance. Accepts a file path, Content Provider URI, streaming media URL path, or File Descriptor. Call prepare on the Media Player before you begin playback MediaPlayer mediaplayer = new MediaPlayer(); mediaplayer.setdatasource("/sdcard/test.3gp"); mediaplayer.prepare(); Page 8 Fall 2011 CS 495/595 - App Development for Smart Devices

9 Preparing for Video Playback Need to specify a display surface on which to show the video. Two methods: <VideoView android:id="@+id/videoview android:layout_height="fill_parent" android:layout_width="fill_parent" > </VideoView> <SurfaceView android:id="@+id/surface" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"> </SurfaceView> Use the VideoView control, encapsulates the creation of a display surface and allocation and preparation of video content within a Media Player. Specify your own display surface and manipulate the underlying Media Player instance directly. Page 9 Fall 2011 CS 495/595 - App Development for Smart Devices

10 Video Playback using Video View The Video View supports the playback of local or streaming video as supported by the Media Player component. Video Views conveniently encapsulate the initialization of the Media Player. To assign a video to play, call setvideopath or setvideouri to specify the path to a local file, or the URI of a Content Provider or remote video stream: streamingvideoview.setvideouri(" localvideoview.setvideopath("/sdcard/test2.3gp"); Page 10 Fall 2011 CS 495/595 - App Development for Smart Devices

11 Video Playback using Video View Control playback using the start, stopplayback, pause, and seekto methods. The Video View also includes the setkeepscreenon method to apply a screen Wake Lock that will prevent the screen from being dimmed while playback is in progress. VideoView videoview = (VideoView)findViewById(R.id.videoview); videoview.setkeepscreenon(true); videoview.setvideopath("/sdcard/test2.3gp"); if (videoview.canseekforward()) videoview.seekto(videoview.getduration()/2); videoview.start(); [... do something... ] videoview.stopplayback(); Page 11 Fall 2011 CS 495/595 - App Development for Smart Devices

12 Setting a Surface for Video Playback The Media Player view video content by preparing a Surface onto which the video will be displayed. The Media Player requires a SurfaceHolder object for displaying video content, assigned using the setdisplay method. Once created and assigned the Surface Holder to your Media Player, use the setdatasource method to specify the path, URL, or Content Provider URI of the video resource to play. Call prepare to initialize the Media Player in preparation for playback To include a Surface Holder in your UI layout you use the SurfaceView control as shown in the sample layout XML Page 12 Fall 2011 CS 495/595 - App Development for Smart Devices

13 Surface for Video Playback Sample layout including a Surface View <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <SurfaceView android:id="@+id/surface" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"> </SurfaceView> </LinearLayout> Page 13 Fall 2011 CS 495/595 - App Development for Smart Devices

14 Surface for Video Playback Initializing and assigning a Surface View to a Media Player (1) public class MyActivity extends Activity implements SurfaceHolder.Callback { private MediaPlayer public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); mediaplayer = new MediaPlayer(); SurfaceView surface = (SurfaceView)findViewById(R.id.surface); SurfaceHolder holder = surface.getholder(); holder.addcallback(this); holder.settype(surfaceholder.surface_type_push_buffers); holder.setfixedsize(400, 300); Page 14 Fall 2011 CS 495/595 - App Development for Smart Devices

15 Surface for Video Playback Initializing and assigning a Surface View to a Media Player (2) public void surfacecreated(surfaceholder holder) { try { mediaplayer.setdisplay(holder); mediaplayer.setdatasource("/sdcard/test2.3gp"); mediaplayer.prepare(); mediaplayer.start(); catch (IllegalArgumentException e) { Log.d("MEDIA_PLAYER", e.getmessage()); catch (IllegalStateException e) { Log.d("MEDIA_PLAYER", e.getmessage()); catch (IOException e) { Log.d("MEDIA_PLAYER", e.getmessage()); public void surfacedestroyed(surfaceholder holder) { mediaplayer.release(); public void surfacechanged(surfaceholder holder, int format, int width, int height) { Page 15 Fall 2011 CS 495/595 - App Development for Smart Devices

16 Controlling Playback Once a Media Player is prepared, call start to begin playback. Use the stop and pause methods to stop or pause playback. The Media Player also provides the getduration method to find the length of the media being played, and getcurrentposition to find the playback position. Use seekto to jump to a specific position. mediaplayer.start(); int pos = mediaplayer.getcurrentposition(); int duration = mediaplayer.getduration(); mediaplayer.seekto(pos + (duration-pos)/10); [... wait for a duration... ] mediaplayer.stop(); Page 16 Fall 2011 CS 495/595 - App Development for Smart Devices

17 Controlling Playback Use the islooping and setlooping methods to specify if the media being played should loop when it completes. if (!mediaplayer.islooping()) mediaplayer.setlooping(true); To enable a Wake Lock that will keep the screen on during video playback use the setscreenonwhileplaying method. mediaplayer.setscreenonwhileplaying(true); To control the volume for each channel during playback using the setvolume method. It takes a scalar float value between 0 and 1 for both the left and right channels. mediaplayer.setvolume(1f, 0.5f); Page 17 Fall 2011 CS 495/595 - App Development for Smart Devices

18 Recording Audio & Video Page 18 Spring 2011 CS 752/852 - Wireless and Mobile Networking

19 Recording Audio and Video Two alternatives for recording audio and video within your application: The simplest is to use Intents to launch the video camera app. This option lets you specify the output location and video recording quality, while letting the native video recording application handle the user experience and error handling. The other is to use the Media Recorder class. This option lets you to replace the native app, get more fine-grained control over the video capture UI or recording settings. Page 19 Fall 2011 CS 495/595 - App Development for Smart Devices

20 Using Intents to Record Video Use the ACTION_VIDEO_CAPTURE Media Store static constant in an Intent passed to startactivityforresult to launch the native video camera Activity. startactivityforresult (new Intent(MediaStore.ACTION_VIDEO_CAPTURE), RECORD_VIDEO); The video capture action supports two optional extras EXTRA_OUTPUT - By default, the video recorded will be stored in the default Media Store. If you want to record it elsewhere, you can specify an alternative URI using this extra. EXTRA_VIDEO_QUALITY - The video record action allows you to specify an image quality using an integer value: 0 for low (MMS) quality videos or 1 for high (full resolution) videos. By default, the high resolution mode will be used. Page 20 Fall 2011 CS 495/595 - App Development for Smart Devices

21 Using Intents to Record Video private static int RECORD_VIDEO = 1; private static int HIGH_VIDEO_QUALITY = 1; private static int MMS_VIDEO_QUALITY = 0; private void recordvideo(uri outputpath) { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); if (outputpath!= null) intent.putextra(mediastore.extra_output, output); intent.putextra(mediastore.extra_video_quality, HIGH_VIDEO_QUALITY); startactivityforresult(intent, protected void onactivityresult(int requestcode, int resultcode, Intent data) { if (requestcode == RECORD_VIDEO) { Uri recordedvideo = data.getdata(); // TODO Do something with the recorded video Page 21 Fall 2011 CS 495/595 - App Development for Smart Devices

22 Using the Media Recorder Multimedia recording is handled by MediaRecorder class to record audio and/or video files Your application needs the RECORD_AUDIO and/or RECORD_VIDEO permissions in manifest file. o o <uses-permission android:name="android.permission.record_audio"/> <uses-permission android:name="android.permission.record_video"/> To record, create a new Media Recorder object. Call release on Media Recorder object to free the associated resources Reference: Page 22 Fall 2011 CS 495/595 - App Development for Smart Devices

23 Using the Media Recorder The Media Recorder manages recording as a state machine. Create a new Media Recorder. Assign it the input sources to record from. Define the output format. Specify the audio and video encoder, frame rate, and output size. Select an output file. Prepare for recording. Record. End recording. Page 23 Fall 2011 CS 495/595 - App Development for Smart Devices

24 Configure/Control Video Recording MediaRecorder mediarecorder = new MediaRecorder(); // Configure the input sources mediarecorder.setaudiosource(mediarecorder.audiosource.mic); mediarecorder.setvideosource(mediarecorder.videosource.camera); // Set the output format mediarecorder.setoutputformat(mediarecorder.outputformat.default); // Specify the audio and video encoding mediarecorder.setaudioencoder(mediarecorder.audioencoder.default); mediarecorder.setvideoencoder(mediarecorder.videoencoder.default); // Specify the output file mediarecorder.setoutputfile("/sdcard/myoutputfile.mp4"); // Prepare to record mediarecorder.prepare(); [ ] mediarecorder.start(); [ ] mediarecorder.stop(); mediarecorder.release(); Page 24 Fall 2011 CS 495/595 - App Development for Smart Devices

25 Using Camera and Taking Pictures The easiest way is using the ACTION_IMAGE_CAPTURE Media Store static constant in an Intent passed to startactivityforresult startactivityforresult (new Intent(MediaStore.ACTION_IMAGE_CAPTURE), TAKE_PICTURE); The image capture action supports two modes: Thumbnail - By default, the picture taken will return a thumbnail Bitmap in the data extra within the Intent parameter returned in onactivityresult. Call getparcelableextra specifying the extra name data on the Intent parameter to return the thumbnail as a Bitmap. Full image - Specify an output URI using a MediaStore.EXTRA_OUTPUT extra in the launch Intent, the full-size image taken by the camera will be saved to the specified location. No thumbnail will be returned in the Activity result callback and the result Intent data will be null. Page 25 Fall 2011 CS 495/595 - App Development for Smart Devices

26 Taking Pictures using Intent private static int TAKE_PICTURE = 1; private Uri outputfileuri; private void getthumbailpicture() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startactivityforresult(intent, TAKE_PICTURE); private void savefullimage() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File file = new File(Environment.getExternalStorageDirectory(), "test.jpg"); outputfileuri = Uri.fromFile(file); intent.putextra(mediastore.extra_output, outputfileuri); startactivityforresult(intent, TAKE_PICTURE); Page 26 Fall 2011 CS 495/595 - App Development for Smart Devices

27 Taking Pictures using protected void onactivityresult(int requestcode, int resultcode, Intent picdata) { if (requestcode == TAKE_PICTURE) { Uri imageuri = null; // Check if the result includes a thumbnail Bitmap if (picdata!= null) { if (picdata.hasextra("data")) { Bitmap thumbnail = picdata.getparcelableextra("data"); // TODO Do something with the thumbnail else { // TODO Do something with the full image stored // in outputfileuri Page 27 Fall 2011 CS 495/595 - App Development for Smart Devices

28 Using Camera Need to add the CAMERA permission to your application manifest. o <uses-permission android:name="android.permission.camera"/> To access the Camera Service, use open method on the Camera class. When you re done, relinquish your hold on Camera by calling release Camera camera = Camera.open(); [... Do things with the camera... ] camera.release(); To modify camera settings, use the set* methods on Camera.Parameters object. Then, call Camera s setparameters method to pass modified Parameters object. Camera.Parameters parameters = camera.getparameters(); List<String> coloreffects = parameters.getsupportedcoloreffects(); if (coloreffects.contains(camera.parameters.effect_sepia)) parameters.setcoloreffect(camera.parameters.effect_sepia); camera.setparameters(parameters); Parameter Reference: Page 28 Fall 2011 CS 495/595 - App Development for Smart Devices

29 Using Camera Monitor the success of the Camera auto focus operation by adding an AutoFocusCallback to the Camera object. camera.autofocus(new AutoFocusCallback() { public void onautofocus(boolean success, Camera camera) { // TODO Do something on Auto-Focus success ); To view the live camera stream, include a Surface View. Implement a SurfaceHolder.Callback to listen for surface s construction, before passing it in to the setpreviewdisplay method of Camera object. A call to startpreview will begin the streaming and stoppreview will end it public class MyActivity extends Activity implements SurfaceHolder.Callback { private Camera public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); SurfaceView surface = (SurfaceView)findViewById(R.id.surface); SurfaceHolder holder = surface.getholder(); Page 29 Fall 2011 CS 495/595 - App Development for Smart Devices

30 Using Camera holder.addcallback(this); holder.settype(surfaceholder.surface_type_push_buffers); holder.setfixedsize(400, 300); public void surfacecreated(surfaceholder holder) { if (mediarecorder == null) { try { camera = camera.open(); camera.setpreviewdisplay(holder); camera.startpreview(); [... Draw on the Surface... ] catch (IOException e) { Log.d("CAMERA", e.getmessage()); public void surfacedestroyed(surfaceholder holder) { camera.stoppreview(); camera.release(); Page 30 Fall 2011 CS 495/595 - App Development for Smart Devices

31 Taking Pictures using Camera Call takepicture and pass in a ShutterCallback and two PictureCallback implementations (for RAW and JPEG-encoded). The shutter callback is triggered immediately after the shutter is closed. private void takepicture() { camera.takepicture(shuttercallback, rawcallback, jpegcallback); ShutterCallback shuttercallback = new ShutterCallback() { public void onshutter() { // TODO Do something when the shutter closes. ; PictureCallback rawcallback = new PictureCallback() { public void onpicturetaken(byte[] data, Camera camera) { // TODO Do something with the image RAW data. ; Page 31 Fall 2011 CS 495/595 - App Development for Smart Devices

32 Taking Pictures using Camera PictureCallback jpegcallback = new PictureCallback() { public void onpicturetaken(byte[] data, Camera camera) { ; // Save the image JPEG data to the SD card FileOutputStream outstream = null; try { outstream = new FileOutputStream("/sdcard/test.jpg"); outstream.write(data); outstream.close(); catch (FileNotFoundException e) { Log.d("CAMERA", e.getmessage()); catch (IOException e) { Log.d("CAMERA", e.getmessage()); Page 32 Fall 2011 CS 495/595 - App Development for Smart Devices

33 Recording Sound Use the AudioRecord class to record audio directly from the hardware buffers. int buffersize = AudioRecord.getMinBufferSize(frequency, channelconfiguration, audioencoding); AudioRecord audiorecord = new AudioRecord(MediaRecorder.AudioSource.MIC, frequency, channelconfiguration, audioencoding, buffersize); Add RECORD_AUDIO manifest permission in manifest. o <uses-permission android:name="android.permission.record_audio"/>. Run the startrecording method to begin asynchronous recording. Use the read method to add raw audio data into the recording buffer audiorecord.startrecording(); while (isrecording) { [... populate the buffer... ] int bufferreadresult = audiorecord.read(buffer, 0, buffersize); Page 33 Fall 2011 CS 495/595 - App Development for Smart Devices

34 Recording Sound (Example) int frequency = 11025; int channelconfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO; int audioencoding = AudioFormat.ENCODING_PCM_16BIT; File file = new File(Environment.getExternalStorageDirectory(), "raw.pcm"); // Create the new file. try { file.createnewfile(); catch (IOException e) { try { OutputStream os = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(os); DataOutputStream dos = new DataOutputStream(bos); int buffersize = AudioRecord.getMinBufferSize(frequency, channelconfiguration, audioencoding); Page 34 Fall 2011 CS 495/595 - App Development for Smart Devices

35 Recording Sound (Example) short[] buffer = new short[buffersize]; // Create a new AudioRecord object to record the audio. AudioRecord audiorecord = new AudioRecord(MediaRecorder.AudioSource.MIC, frequency, channelconfiguration, audioencoding, buffersize); audiorecord.startrecording(); while (isrecording) { int bufferreadresult = audiorecord.read(buffer, 0, buffersize); for (int i = 0; i < bufferreadresult; i++) dos.writeshort(buffer[i]); audiorecord.stop(); dos.close(); catch (Throwable t) { Page 35 Fall 2011 CS 495/595 - App Development for Smart Devices

36 Playing Sound Use the AudioTrack class to play raw audio directly into the hardware buffers. AudioTrack audiotrack = new AudioTrack(AudioManager.STREAM_MUSIC, frequency, channelconfiguration, audioencoding, audiolength, AudioTrack.MODE_STREAM); Run the play method to begin asynchronous playback, and use the write method to add raw audio data into the playback buffer. audiotrack.play(); audiotrack.write(audio, 0, audiolength); Write audio into the Audio Track buffer either before play has been called or after. In the former case, playback will commence as soon as play is called. In the latter playback will begin as soon as you write data to the Audio Track buffer. Page 36 Fall 2011 CS 495/595 - App Development for Smart Devices

37 Playing Sound (Example) int frequency = 11025/2; int channelconfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO; int audioencoding = AudioFormat.ENCODING_PCM_16BIT; File file = new File(Environment.getExternalStorageDirectory(), "raw.pcm"); // Short array to store audio track (16 bit so 2 bytes per short) int audiolength = (int)(file.length()/2); short[] audio = new short[audiolength]; try { InputStream is = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(is); DataInputStream dis = new DataInputStream(bis); Page 37 Fall 2011 CS 495/595 - App Development for Smart Devices

38 Playing Sound (Example) int i = 0; while (dis.available() > 0) { audio[audiolength] = dis.readshort(); i++; // Close the input streams. dis.close(); // Create and play a new AudioTrack object AudioTrack audiotrack = new AudioTrack(AudioManager.STREAM_MUSIC, frequency, channelconfiguration, audioencoding, audiolength, AudioTrack.MODE_STREAM); audiotrack.play(); audiotrack.write(audio, 0, audiolength); catch (Throwable t) { Page 38 Fall 2011 CS 495/595 - App Development for Smart Devices

39 Speech Recognition Android supports voice input and speech recognition using the RecognizerIntent class. Voice recognition is initiated by calling startnewactivityforresult, passing in an Intent with RecognizerIntent.ACTION_RECOGNIZE_SPEECH Intent must include RecognizerIntent.EXTRA_LANGUAGE_MODEL extra to specify the language model used to parse the input audio (LANGUAGE_MODEL_FREE_FORM, or LANGUAGE_MODEL_WEB_SEARCH). You can also specify a number of optional extras: EXTRA_PROMPT Specify a string that will be displayed in the voice input dialog to prompt the user to speak. EXTRA_MAXRESULTS Integer value to limit the number of potential recognition results returned. EXTRA_LANGUAGE Specify an input language other than the device default. Page 39 Fall 2011 CS 495/595 - App Development for Smart Devices

40 Speech Recognition (Example) Voice recognition in English, returning one result, with custom prompt. Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) // Specify free form input intent.putextra(recognizerintent.extra_language_model, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putextra(recognizerintent.extra_prompt, "or forever hold your peace"); intent.putextra(recognizerintent.extra_max_results, 1); intent.putextra(recognizerintent.extra_language, Locale.ENGLISH); startactivityforresult(intent, VOICE_RECOGNITION); Page 40 Fall 2011 CS 495/595 - App Development for Smart Devices

41 Speech Recognition (Example) The results are returned through the onactivityresult handler as an Array List of strings in the EXTRA_RESULTS extra each represents a potential protected void onactivityresult(int requestcode, int resultcode, Intent data) { if (requestcode == VOICE VOICE_RECOGNITION && resultcode == RESULT_OK) { ArrayList<String> results; results = data.getstringarraylistextra(recognizerintent.extra_results); // TODO Do something with the recognized voice strings super.onactivityresult(requestcode, resultcode, data); Page 41 Fall 2011 CS 495/595 - App Development for Smart Devices

42 Questions? Page 42 Spring 2011 CS 752/852 - Wireless and Mobile Networking

43 To DO Example - SoundPool Example - VideoView Page 43 Fall 2011 CS 495/595 - App Development for Smart Devices

44 SoundPool Android provides two API's for playing sounds: SoundPool and MediaPlayer. SoundPool can be used for small audio clips. It can repeat sounds and play several sounds simultaneously. The sound files played with SoundPool should not exceed 1 MB. SoundPool does load the file asynchronously. In recent Android SDK, it is possible to check if the loading is complete via OnLoadCompleteListener. Mediaplayer is better suited for longer music and movies. Page 44 Fall 2011 CS 495/595 - App Development for Smart Devices

45 Example of SoundPool Create an application that will start playing a sound once the finger touches the display. Create an Android project cs.edu.odu.cs495.soundpool" with the Activity "PlaySound Get a free sound effect from put it into your "res/raw" folder under the name "sound1.ogg". main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:text="click on the screen to start playing" android:id="@+id/textview1" android:layout_width="fill_parent" android:layout_height="fill_parent"> </TextView> </LinearLayout> Page 45 Fall 2011 CS 495/595 - App Development for Smart Devices

46 Example of SoundPool package edu.odu.cs.cs495.soundpool; import android.app.activity; import android.media.audiomanager; import android.media.soundpool; import android.media.soundpool.onloadcompletelistener; import android.os.bundle; import android.util.log; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; public class PlaySound extends Activity implements OnTouchListener { private SoundPool soundpool; private int soundid; boolean loaded = false; Page 46 Fall 2011 CS 495/595 - App Development for Smart Devices

47 Example of SoundPool /** Called when the activity is first created. public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); View view = findviewbyid(r.id.textview1); view.setontouchlistener(this); // Set the hardware buttons to control the music this.setvolumecontrolstream(audiomanager.stream_music); // Load the sound soundpool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); soundpool.setonloadcompletelistener(new OnLoadCompleteListener() public void onloadcomplete(soundpool soundpool, int sampleid, int status) { loaded = true; ); soundid = soundpool.load(this, R.raw.sound1, 1); Page 47 Fall 2011 CS 495/595 - App Development for Smart Devices

48 Example of public boolean ontouch(view v, MotionEvent event) { if (event.getaction() == MotionEvent.ACTION_DOWN) { // Getting the user sound settings AudioManager audiomanager = (AudioManager) getsystemservice(audio_service); float actualvolume = (float) audiomanager. getstreamvolume(audiomanager.stream_music); float maxvolume = (float) audiomanager. getstreammaxvolume(audiomanager.stream_music); float volume = actualvolume / maxvolume; // Is the sound loaded already? if (loaded) { soundpool.play(soundid, volume, volume, 1, 0, 1f); Log.e("Test", "Played sound"); return false; Page 48 Fall 2011 CS 495/595 - App Development for Smart Devices

49 Example of VideoView A simple example using VideoView to play 3gp from YouTube main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <VideoView android:id="@+id/myvideoview" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> Page 49 Fall 2011 CS 495/595 - App Development for Smart Devices

50 Example of VideoView package edu.odu.cs.cs495.myvideoview; import android.app.activity; import android.net.uri; import android.os.bundle; import android.widget.mediacontroller; import android.widget.videoview; public class MyVideoView extends Activity { String SrcPath = "rtsp://<replace WITH PATH TO YouTube video (3gp)>"; /** Called when the activity is first created. public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); VideoView myvideoview = (VideoView)findViewById(R.id.myvideoview); myvideoview.setvideouri(uri.parse(srcpath)); myvideoview.setmediacontroller(new MediaController(this)); myvideoview.requestfocus(); myvideoview.start(); Page 50 Fall 2011 CS 495/595 - App Development for Smart Devices

App Development for Smart Devices. Lec #7: Audio, Video & Telephony Try It Out

App Development for Smart Devices. Lec #7: Audio, Video & Telephony Try It Out App Development for Smart Devices CS 495/595 - Fall 2013 Lec #7: Audio, Video & Telephony Try It Out Tamer Nadeem Dept. of Computer Science Trt It Out Example - SoundPool Example - VideoView Page 2 Fall

More information

Terms: MediaPlayer, VideoView, MediaController,

Terms: MediaPlayer, VideoView, MediaController, Terms: MediaPlayer, VideoView, MediaController, Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283

More information

<uses-permission android:name="android.permission.internet"/>

<uses-permission android:name=android.permission.internet/> Chapter 11 Playing Video 11.1 Introduction We have discussed how to play audio in Chapter 9 using the class MediaPlayer. This class can also play video clips. In fact, the Android multimedia framework

More information

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다.

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다. 1 카메라 1.1 제어절차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다. 1.2 관련주요메서드 setpreviewdisplay() : startpreview() : stoppreview(); onpicturetaken() : 사진을찍을때자동으로호출되며캡처한이미지가전달됨 1.3 제작철차 Step 1 프로젝트를생성한후매니페스트에퍼미션들을설정한다.

More information

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics Chapter 10 Speech Recognition 10.1 Introduction Speech recognition (SR) by machine, which translates spoken words into text has been a goal of research for more than six decades. It is also known as automatic

More information

Workshop. 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking

Workshop. 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking Workshop 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking 2. Create Intent with Parsing Data (Page 3 8) Making Phone Call and Dial Access Web Content Playing YouTube Video 3. Create

More information

Mul$media Techniques in Android. Some of the informa$on in this sec$on is adapted from WiseAndroid.com

Mul$media Techniques in Android. Some of the informa$on in this sec$on is adapted from WiseAndroid.com Mul$media Techniques in Android Some of the informa$on in this sec$on is adapted from WiseAndroid.com Mul$media Support Android provides comprehensive mul$media func$onality: Audio: all standard formats

More information

Multimedia Support Classes Playing Audio Watching Video Recording Audio

Multimedia Support Classes Playing Audio Watching Video Recording Audio Multimedia Support Classes Playing Audio Watching Video Recording Audio Android provides support for encoding and decoding a variety of common media formats Allows you to play & record audio, still images

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II) Media Playback Engine Android provides a media playback engine at the native level called Stagefright that comes built-in with software-based

More information

Developing Android Applications

Developing Android Applications Developing Android Applications Introduction to Software Engineering Fall 2015 Updated 21 October 2015 Android Lab 02 Advanced Android Features 2 Class Plan UI Elements Activities Intents Data Transfer

More information

Android. Soft Keyboard Graphics and Media

Android. Soft Keyboard Graphics and Media Android Soft Keyboard Graphics and Media Soft keyboards Devices can have hard keyboards or only a directional pad (arrows plus select) But most don t have keyboards All have soft keyboards controlled by

More information

App Development for Smart Devices. Lec #18: Advanced Topics

App Development for Smart Devices. Lec #18: Advanced Topics App Development for Smart Devices CS 495/595 - Fall 2011 Lec #18: Advanced Topics Tamer Nadeem Dept. of Computer Science Objective Web Browsing Android Animation Android Backup Presentation - Developing

More information

Android Help. Section 8. Eric Xiao

Android Help. Section 8. Eric Xiao Android Help Section 8 Eric Xiao The Midterm That happened Any residual questions? New Assignment! Make a low-fi prototype Must be interactive Use balsamiq or paper Test it with users 3 tasks Test task

More information

GATAV 5. Animations Using a Game Loop

GATAV 5. Animations Using a Game Loop GATAV 5. Animations Using a Game Loop TOC 1. The basic principle. 2. Creating bubbles. 3. Making the bubbles more look alive. 4. The appearent look. 5. Making the audiance impressed. 6. Now it up to you:

More information

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah. Islamic University of Gaza Faculty of Engineering Computer Engineering Department Mobile Computing ECOM 5341 By Eng. Wafaa Audah July 2013 1 Launch activitits, implicit intents, data passing & start activity

More information

package import import import import import import import public class extends public void super new this class extends public super public void new

package import import import import import import import public class extends public void super new this class extends public super public void new Android 2-D Drawing Android uses a Canvas object to host its 2-D drawing methods. The program below draws a blue circle on a white canvas. It does not make use of the main.xml layout but draws directly

More information

Android Workshop: Model View Controller ( MVC):

Android Workshop: Model View Controller ( MVC): Android Workshop: Android Details: Android is framework that provides java programmers the ability to control different aspects of smart devices. This interaction happens through the Android SDK (Software

More information

Noisy Androids Mastering the Android Media Framework

Noisy Androids Mastering the Android Media Framework Noisy Androids Mastering the Android Media Framework Dave Sparks 27-May-2009 Agenda Frank Lloyd Android: Media Framework architecture Sweet Android: What's new in Cupcake V1.5? Busted Android: Common problems

More information

Basic UI elements: Android Buttons (Basics) Marco Ronchetti Università degli Studi di Trento

Basic UI elements: Android Buttons (Basics) Marco Ronchetti Università degli Studi di Trento Basic UI elements: Android Buttons (Basics) Marco Ronchetti Università degli Studi di Trento Let s work with the listener Button button = ; button.setonclicklistener(new.onclicklistener() { public void

More information

8/30/15 MOBILE COMPUTING. CSE 40814/60814 Fall How many of you. have implemented a command-line user interface?

8/30/15 MOBILE COMPUTING. CSE 40814/60814 Fall How many of you. have implemented a command-line user interface? MOBILE COMPUTING CSE 40814/60814 Fall 2015 How many of you have implemented a command-line user interface? 1 How many of you have implemented a graphical user interface? HTML/CSS Java Swing.NET Framework

More information

Android. Soft Keyboard Graphics and Media. Soft keyboards. Action events. Tailoring the soft keyboard

Android. Soft Keyboard Graphics and Media. Soft keyboards. Action events. Tailoring the soft keyboard Android Soft Keyboard Graphics and Media Soft keyboards Devices can have hard keyboards or only a directional pad (arrows plus select) But most don t have keyboards All have soft keyboards controlled by

More information

Advanced Android Development

Advanced Android Development Advanced Android Development review of greporter open-source project: GPS, Audio / Photo Capture, SQLite, HTTP File Upload and more! Nathan Freitas, Oliver+Coady nathan@olivercoady.com Android Platform

More information

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology Android App Development Mr. Michaud ICE Programs Georgia Institute of Technology Android Operating System Created by Android, Inc. Bought by Google in 2005. First Android Device released in 2008 Based

More information

Thread. A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables.

Thread. A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables. 1 Thread A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables. Each virtual machine instance has at least one main

More information

Mobila applikationer och trådlösa nät

Mobila applikationer och trådlösa nät Mobila applikationer och trådlösa nät HI1033 Lecture 8 Today s topics Location Based Services Google Maps API MultiMedia Location Based Services LocationManager provides access to location based services

More information

Manifest.xml. Activity.java

Manifest.xml. Activity.java Dr.K.Somasundaram Ph.D Professor Department of Computer Science and Applications Gandhigram Rural Institute, Gandhigram, Tamil Nadu-624302, India ka.somasundaram@gmail.com Manifest.xml

More information

Learn about Android Content Providers and SQLite

Learn about Android Content Providers and SQLite Tampa Bay Android Developers Group Learn about Android Content Providers and SQLite Scott A. Thisse March 20, 2012 Learn about Android Content Providers and SQLite What are they? How are they defined?

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Saving State THE PROBLEM How to save the state (of a UI, for instance) so that it survives even when the application is closed/killed The state should

More information

Vienos veiklos būsena. Theory

Vienos veiklos būsena. Theory Vienos veiklos būsena Theory While application is running, we create new Activities and close old ones, hide the application and open it again and so on, and Activity can process all these events. It is

More information

Introduction to Mobile Application Development Using Android Week Four Video Lectures

Introduction to Mobile Application Development Using Android Week Four Video Lectures Introduction to Mobile Application Development Using Android Week Four Video Lectures Week Four: Lecture 1: Unit 1: Multimedia Multimedia Support in Android Multimedia Support in Android We are now going

More information

Operator s Manual. minibht Audiometry Android App. Team 2. Samir Dahmani, Nihit Mody, Joseph Wolanski. Client: Dr. Oliver

Operator s Manual. minibht Audiometry Android App. Team 2. Samir Dahmani, Nihit Mody, Joseph Wolanski. Client: Dr. Oliver Operator s Manual minibht Audiometry Android App Team 2 Samir Dahmani, Nihit Mody, Joseph Wolanski Client: Dr. Oliver Farmington, CT UConn Health Center Table Of Contents: 1 Introduction 1.1 General Overview

More information

Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard.

Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard. 44 CHAPTER 2 Android s development environment Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard. TIP You ll want the package name of your applications to be unique

More information

Mul$media Support in Android

Mul$media Support in Android Mul$media Support in Android Mul$media Support Android provides comprehensive mul$media func$onality: Audio: all standard formats including MP3, Ogg, Midi, Video: MPEG- 4, H.263, H.264, Images: PNG (preferred),

More information

Using Libraries, Text-to-Speech, Camera. Lecture 12

Using Libraries, Text-to-Speech, Camera. Lecture 12 Using Libraries, Text-to-Speech, Camera Lecture 12 Libraries Many Android developers have produced useful libraries. There is a Maven repository to store various libraries This makes it easy to add them

More information

Intents. Your first app assignment

Intents. Your first app assignment Intents Your first app assignment We will make this. Decidedly lackluster. Java Code Java Code XML XML Preview XML Java Code Java Code XML Buttons that work

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Managing Screen Orientation ORIENTATIONS Portrait Landscape Reverse portrait Reverse landscape ON REVERSE PORTRAIT Android: all four orientations are

More information

Multiple Activities. Many apps have multiple activities

Multiple Activities. Many apps have multiple activities Intents Lecture 7 Multiple Activities Many apps have multiple activities An activity A can launch another activity B in response to an event The activity A can pass data to B The second activity B can

More information

Meniu. Create a project:

Meniu. Create a project: Meniu Create a project: Project name: P0131_MenuSimple Build Target: Android 2.3.3 Application name: MenuSimple Package name: ru.startandroid.develop.menusimple Create Activity: MainActivity Open MainActivity.java.

More information

Arrays of Buttons. Inside Android

Arrays of Buttons. Inside Android Arrays of Buttons Inside Android The Complete Code Listing. Be careful about cutting and pasting.

More information

EMBEDDED SYSTEMS PROGRAMMING Application Basics

EMBEDDED SYSTEMS PROGRAMMING Application Basics EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there

More information

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Playing Sound and Video Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Playing Sound and Video Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 4a: Playing Sound and Video Emmanuel Agu Reminder: Final Project 1-slide from group in 2 weeks Thursday October 11: 2/30 of final project grade Slide should

More information

Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26

Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26 Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26 Inject one subtle defect (fault seeding) To be reviewed by a few class members Usability study by CPE 484 students

More information

SMAATSDK. NFC MODULE ON ANDROID REQUIREMENTS AND DOCUMENTATION RELEASE v1.0

SMAATSDK. NFC MODULE ON ANDROID REQUIREMENTS AND DOCUMENTATION RELEASE v1.0 SMAATSDK NFC MODULE ON ANDROID REQUIREMENTS AND DOCUMENTATION RELEASE v1.0 NFC Module on Android Requirements and Documentation Table of contents Scope...3 Purpose...3 General operating diagram...3 Functions

More information

Real-Time Embedded Systems

Real-Time Embedded Systems Real-Time Embedded Systems DT8025, Fall 2016 http://goo.gl/azfc9l Lecture 8 Masoumeh Taromirad m.taromirad@hh.se Center for Research on Embedded Systems School of Information Technology 1 / 51 Smart phones

More information

Contents. Player Camera AudioIn, AudioOut Image & ImageUtil AudioRecorder VideoRecorder AudioDecoder/Encoder, VideoDecoder/Encoder

Contents. Player Camera AudioIn, AudioOut Image & ImageUtil AudioRecorder VideoRecorder AudioDecoder/Encoder, VideoDecoder/Encoder Media Contents Player Camera AudioIn, AudioOut Image & ImageUtil AudioRecorder VideoRecorder AudioDecoder/Encoder, VideoDecoder/Encoder 2 Introduction The Media namespace contains classes and interfaces

More information

Writing Efficient Drive Apps for Android. Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations

Writing Efficient Drive Apps for Android. Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations Writing Efficient Drive Apps for Android Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations Raise your hand if you use Google Drive source: "put your hands up!" (CC-BY) Raise the other

More information

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator. Simple Android Application for Native Calculator Aim: To develop a Simple Android Application for Native Calculator. Procedure: Creating a New project: Open Android Stdio and then click on File -> New

More information

CS378 -Mobile Computing. Audio

CS378 -Mobile Computing. Audio CS378 -Mobile Computing Audio Android Audio Use the MediaPlayer class Common Audio Formats supported: MP3, MIDI (.mid and others), Vorbis(.ogg), WAVE (.wav) and others Sources of audio local resources

More information

API Guide for Gesture Recognition Engine. Version 2.0

API Guide for Gesture Recognition Engine. Version 2.0 API Guide for Gesture Recognition Engine Version 2.0 Table of Contents Gesture Recognition API... 3 API URI... 3 Communication Protocol... 3 Getting Started... 4 Protobuf... 4 WebSocket Library... 4 Project

More information

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH Android Basics - Bhaumik Shukla Android Application Developer @ STEALTH FLASH Introduction to Android Android is a software stack for mobile devices that includes an operating system, middleware and key

More information

COMP61242: Task 3 1 2/05/18

COMP61242: Task 3 1 2/05/18 COMP61242: Task 3 1 2/05/18 1. Introduction University of Manchester School of Computer Science COMP61242: Mobile Communications Semester 2: 2017-18 Laboratory Task 3 Communicating with Android Smart-phones

More information

ANDROID SDK. Developers Guide

ANDROID SDK. Developers Guide ANDROID SDK Developers Guide Content description This is a reference manual and configuration guide for the NeoCheck Document Verification Android SDK product. It shows how to interact with the Xamarin

More information

Android HelloWorld - Example. Tushar B. Kute,

Android HelloWorld - Example. Tushar B. Kute, Android HelloWorld - Example Tushar B. Kute, http://tusharkute.com Anatomy of Android Application Anatomy of Android Application Java This contains the.java source files for your project. By default, it

More information

Embedded Systems Programming - PA8001

Embedded Systems Programming - PA8001 Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 8 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering

More information

Software Practice 3 Before we start Today s lecture Today s Task Team organization

Software Practice 3 Before we start Today s lecture Today s Task Team organization 1 Software Practice 3 Before we start Today s lecture Today s Task Team organization Prof. Hwansoo Han T.A. Jeonghwan Park 43 2 Lecture Schedule Spring 2017 (Monday) This schedule can be changed M A R

More information

Interface ใน View class ประกอบด วย

Interface ใน View class ประกอบด วย Boonrit kidngan Interface ใน View class ประกอบด วย View.OnClickListener เม อม การ click View.OnLongClickListener เม อม การ click ค าง View.OnFocusChangeListener เม อเปล ยนการเล อก View.OnKeyListener เม

More information

Applications. Marco Ronchetti Università degli Studi di Trento

Applications. Marco Ronchetti Università degli Studi di Trento Applications Marco Ronchetti Università degli Studi di Trento Android Applications An Android application typically consists of one or more related, loosely bound activities for the user to interact with.

More information

Android Development Crash Course

Android Development Crash Course Android Development Crash Course Campus Sundsvall, 2015 Stefan Forsström Department of Information and Communication Systems Mid Sweden University, Sundsvall, Sweden OVERVIEW The Android Platform Start

More information

Basic GUI elements - exercises

Basic GUI elements - exercises Basic GUI elements - exercises https://developer.android.com/studio/index.html LIVE DEMO Please create a simple application, which will be used to calculate the area of basic geometric figures. To add

More information

Android Development Tutorial. Yi Huang

Android Development Tutorial. Yi Huang Android Development Tutorial Yi Huang Contents What s Android Android architecture Android software development Hello World on Android More 2 3 What s Android Android Phones Sony X10 HTC G1 Samsung i7500

More information

App Development for Smart Devices. Lec #9: Advanced Topics

App Development for Smart Devices. Lec #9: Advanced Topics App Development for Smart Devices CS 495/595 - Fall 2013 Lec #9: Advanced Topics Tamer Nadeem Dept. of Computer Science Objective Web Browsing Android Animation Android Backup Publishing Your Application

More information

Introduction to Android Multimedia

Introduction to Android Multimedia Introduction to Android Multimedia CS 436 Software Development on Mobile By Dr.Paween Khoenkaw Android Intent Intent,Intent-filter What is Intent? -Intent is a message sent from one program to another

More information

COMP4521 EMBEDDED SYSTEMS SOFTWARE

COMP4521 EMBEDDED SYSTEMS SOFTWARE COMP4521 EMBEDDED SYSTEMS SOFTWARE LAB 1: DEVELOPING SIMPLE APPLICATIONS FOR ANDROID INTRODUCTION Android is a mobile platform/os that uses a modified version of the Linux kernel. It was initially developed

More information

Android Services. Victor Matos Cleveland State University. Services

Android Services. Victor Matos Cleveland State University. Services 22 Android Victor Matos Cleveland State University Notes are based on: Android Developers http://developer.android.com/index.html 22. Android Android A Service is an application component that runs in

More information

Computer Science E-76 Building Mobile Applications

Computer Science E-76 Building Mobile Applications Computer Science E-76 Building Mobile Applications Lecture 3: [Android] The SDK, Activities, and Views February 13, 2012 Dan Armendariz danallan@mit.edu 1 http://developer.android.com Android SDK and NDK

More information

UNIT:2 Introduction to Android

UNIT:2 Introduction to Android UNIT:2 Introduction to Android 1 Syllabus 2.1 Overview of Android 2.2 What does Android run On Android Internals? 2.3 Android for mobile apps development 2.5 Environment setup for Android apps Development

More information

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 Comment and Evaluation: This lab introduces us about Android SDK and how to write a program for Android platform. The calculator is pretty easy, everything

More information

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Gill Cleeren Agenda Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Lists and navigation Navigating from master to detail Optimizing the application Preparing

More information

User Interface Design & Development

User Interface Design & Development User Interface Design & Development Lecture Intro to Android João Pedro Sousa SWE 632, Fall 2011 George Mason University features multitasking w/ just-in-time compiler for Dalvik-VM bytecode storage on

More information

Introduction To Android

Introduction To Android Introduction To Android Mobile Technologies Symbian OS ios BlackBerry OS Windows Android Introduction to Android Android is an operating system for mobile devices such as smart phones and tablet computers.

More information

... 1... 2... 2... 3... 3... 4... 4... 5... 5... 6... 6... 7... 8... 9... 10... 13... 14... 17 1 2 3 4 file.txt.exe file.txt file.jpg.exe file.mp3.exe 5 6 0x00 0xFF try { in.skip(9058); catch (IOException

More information

Understanding Intents and Intent Filters

Understanding Intents and Intent Filters 255 Chapter 11 Understanding Intents and Intent Filters This chapter will delve into intents, which are messaging objects that carry communications between the major components of your application your

More information

Notification mechanism

Notification mechanism Notification mechanism Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Portions of this page are reproduced from work created

More information

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license Android Android Mobile operating system developed by Google A complete stack OS, framework A rich set of applications Email, calendar, browser, maps, text messaging, contacts, camera, dialer, music player,

More information

Embedded Systems Programming - PA8001

Embedded Systems Programming - PA8001 Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 9 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering

More information

Android Beginners Workshop

Android Beginners Workshop Android Beginners Workshop at the M O B IL E M O N D AY m 2 d 2 D E V E L O P E R D A Y February, 23 th 2010 Sven Woltmann, AndroidPIT Sven Woltmann Studied Computer Science at the TU Ilmenau, 1994-1999

More information

Action Bar. (c) 2010 Haim Michael. All Rights Reserv ed.

Action Bar. (c) 2010 Haim Michael. All Rights Reserv ed. Action Bar Introduction The Action Bar is a widget that is shown on top of the screen. It includes the application logo on its left side together with items available from the options menu on the right.

More information

Android Development Tutorial

Android Development Tutorial Android Development Tutorial Part II Human-Computer Interaction (COMP 4020) Winter 2013 2 Canvas Example public class CanvasApp extends Activity @Override protected void oncreate(bundle savedinstancestate)

More information

Mobile Image Processing

Mobile Image Processing Mobile Image Processing Part 1: Introduction to mobile image processing on Android" Part 2: Real-time augmentation of viewfinder frames" Part 3: Utilizing optimized functions in the OpenCV library" Digital

More information

Mobile Development Lecture 8: Intents and Animation

Mobile Development Lecture 8: Intents and Animation Mobile Development Lecture 8: Intents and Animation Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Elgayyar.weebly.com 1. Multiple Activities Intents Multiple Activities Many apps have multiple activities.

More information

Overview. Lecture: Implicit Calling via Share Implicit Receiving via Share Launch Telephone Launch Settings Homework

Overview. Lecture: Implicit Calling via Share Implicit Receiving via Share Launch Telephone Launch Settings Homework Implicit Intents Overview Lecture: Implicit Calling via Share Implicit Receiving via Share Launch Telephone Launch Settings Homework Intents Intent asynchronous message used to activate one Android component

More information

Programming of Mobile Services, Spring 2012

Programming of Mobile Services, Spring 2012 Programming of Mobile Services, Spring 2012 HI1017 Lecturer: Anders Lindström, anders.lindstrom@sth.kth.se Lecture 6 Today s topics Android graphics - Views, Canvas, Drawables, Paint - Double buffering,

More information

EMBEDDED SYSTEMS PROGRAMMING Android Services

EMBEDDED SYSTEMS PROGRAMMING Android Services EMBEDDED SYSTEMS PROGRAMMING 2016-17 Android Services APP COMPONENTS Activity: a single screen with a user interface Broadcast receiver: responds to system-wide broadcast events. No user interface Service:

More information

CMSC436: Fall 2013 Week 3 Lab

CMSC436: Fall 2013 Week 3 Lab CMSC436: Fall 2013 Week 3 Lab Objectives: Familiarize yourself with the Activity class, the Activity lifecycle, and the Android reconfiguration process. Create and monitor a simple application to observe

More information

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation 1. Location Services 1.1 GPS Location 1. Create the Android application with the following attributes. Application Name: MyLocation Project Name: Package Name: MyLocation com.example.mylocation 2. Put

More information

LifeStreet Media Android Publisher SDK Integration Guide

LifeStreet Media Android Publisher SDK Integration Guide LifeStreet Media Android Publisher SDK Integration Guide Version 1.12.0 Copyright 2015 Lifestreet Corporation Contents Introduction... 3 Downloading the SDK... 3 Choose type of SDK... 3 Adding the LSM

More information

Android Data Storage

Android Data Storage Lesson 14 Android Persistency: Victor Matos Cleveland State University Notes are based on: The Busy Coder's Guide to Android Development by Mark L. Murphy Copyright 2008-2009 CommonsWare, LLC. ISBN: 978-0-9816780-0-9

More information

Homework 4 - MediaPlayer and Service

Homework 4 - MediaPlayer and Service Homework 4 - MediaPlayer and Service Due: 10/12/18 by 11:59pm I hope that you have fun completing this homework assignment. You are to develop an app that will play a streaming MP3 from FreeMusicArchive.

More information

Android writing files to the external storage device

Android writing files to the external storage device Android writing files to the external storage device The external storage area is what Android knows as the SD card. There is a virtual SD card within the Android file system although this may be of size

More information

Android Programs Day 5

Android Programs Day 5 Android Programs Day 5 //Android Program to demonstrate the working of Options Menu. 1. Create a New Project. 2. Write the necessary codes in the MainActivity.java to create OptionMenu. 3. Add the oncreateoptionsmenu()

More information

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 3 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MainActivity.java File package com.example.tutorialspoint; import android.manifest;

More information

Mobile Image Processing

Mobile Image Processing Mobile Image Processing Examples of mobile image processing Android platform Class resources for Android Eclipse integrated development environment Augmentation of viewfinder frames Debugging with DDMS

More information

Mobile Computing Practice # 2c Android Applications - Interface

Mobile Computing Practice # 2c Android Applications - Interface Mobile Computing Practice # 2c Android Applications - Interface One more step in the restaurants application. 1. Design an alternative layout for showing up in landscape mode. Our current layout is not

More information

Android Programming (5 Days)

Android Programming (5 Days) www.peaklearningllc.com Android Programming (5 Days) Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse tools. This Android

More information

A Crash Course to Android Mobile Platform

A Crash Course to Android Mobile Platform Enterprise Application Development using J2EE Shmulik London Lecture #2 A Crash Course to Android Mobile Platform Enterprise Application Development Using J2EE / Shmulik London 2004 Interdisciplinary Center

More information

API Guide for Gesture Recognition Engine. Version 1.1

API Guide for Gesture Recognition Engine. Version 1.1 API Guide for Gesture Recognition Engine Version 1.1 Table of Contents Table of Contents... 2 Gesture Recognition API... 3 API URI... 3 Communication Protocol... 3 Getting Started... 4 Protobuf... 4 WebSocket

More information

Project - MultiTunes

Project - MultiTunes Project - MultiTunes Caroline Voeffray 1 Hervé Sierro 2 Arnaud Gaspoz 3 Frédéric Aebi 4 May 31, 2012 Master BENEFRI Project about Multimodal Interfaces 2011-2012 Département d Informatique - Departement

More information

Solving an Android Threading Problem

Solving an Android Threading Problem Home Java News Brief Archive OCI Educational Services Solving an Android Threading Problem Introduction by Eric M. Burke, Principal Software Engineer Object Computing, Inc. (OCI) By now, you probably know

More information

Starting Another Activity Preferences

Starting Another Activity Preferences Starting Another Activity Preferences Android Application Development Training Xorsat Pvt. Ltd www.xorsat.net fb.com/xorsat.education Outline Starting Another Activity Respond to the Button Create the

More information

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters Mobile Programming Lecture 5 Composite Views, Activities, Intents and Filters Lecture 4 Review How do you get the value of a string in the strings.xml file? What are the steps to populate a Spinner or

More information