1. Trang chủ
  2. » Công Nghệ Thông Tin

Bài giảng Android nâng cao: Bài 4 - Trương Xuân Nam

43 19 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 43
Dung lượng 1,12 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Bài giảng Android nâng cao: Bài 4 Media Services (continue) + Location Base Services cung cấp cho người học những kiến thức như: Media Services (continue); Global Positioning Services; Geocoding Locations; Mapping Locations. Mời các bạn cùng tham khảo!

Trang 1

ANDROID NÂNG CAO

BÀI 4: Media Services (continue) +

Location Base Services

Trang 2

2 Location Base Services

– Global Positioning Services

– Geocoding Locations

– Mapping Locations

Trang 3

P à1.1

Trang 5

VideoView + MediaController

V V à à à à à à à à à

à à à start , pause , suspend , resume ,

stopPlayback , seekTo (millis)

Trang 10

MediaPlayer + SurfaceView

public class MainActivity extends Activity

implements SurfaceHolder.Callback, OnPreparedListener {

private MediaPlayer mediaPlayer;

protected void onCreate(Bundle savedInstanceState) {

Trang 11

public void onPrepared(MediaPlayer mp) { mediaPlayer.start(); }}

Trang 12

Text to speech

Trang 14

Text to speech

g i activity m c đ nh đ ki m tra có d li u cho TTS ch a

Intent intent = new Intent(Engine.ACTION_CHECK_TTS_DATA);

// d li u đã có t o đ i t ng TTS m c đ nh}

}

Trang 15

Text to speech

TextToSpeech talker = new TextToSpeech(this, new OnInitListener() {

public void onInit(int status) {

talker speak Hi There TextToSpeech QUEUE FLUSH null}

}

TextToSpeech tts = new TextToSpeech(this, new OnInitListener() {

public void onInit(int status) {

if (status != TextToSpeech.SUCCESS) return;

Trang 16

Camera

Trang 17

1 Previewing

2 After shutter is pressed

3 Image transferred from

Trang 18

mImageView = (ImageView) findViewById(R.id.mImageView);

Intent mIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);startActivityForResult(mIntent, 101);

}

private void showToast(Context context, String text) {

Toast.makeText(context, text, 1).show();

}

Trang 19

C à à à à

protected void onActivityResult(int req, int res, Intent intent) {

super.onActivityResult(req, res, intent);

if (res == RESULT_CANCELED) return;

}

Trang 20

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

<uses-feature android:name="android.hardware.camera" />

<uses-feature android:name="android.hardware.camera.autofocus" />

Trang 21

The takePicture Method

Trang 22

Global Positioning Services

P à2.1

Trang 23

Global Positioning Services

Trang 24

Global Positioning Services

< uses-feature android:name ="android.hardware.location" />

< uses-feature android:name ="android.hardware.location.gps" />

Trang 26

Location services: example

Trang 27

Location services: example

Trang 28

Location services: example

Trang 29

Location services: i ch

 Thông qua LocationManager à à y c u

– List<String> getAllProviders (): y t àprovider

– String getBestProviders (Criteria, enableOnly): y provider à

p t i u n

• Criteria: power, accuracy, speed, altitude– LocationProvider getProvider (name): L y provider theo tên

– requestLocationUpdate (providerName, minTime,

minDistance, listener): Yêu u i listener i minTime giây c provider t n ch n midDistance t

Trang 30

mili-Geocoding Locations

Trang 32

Geocoding Locations - example

Trang 33

Geocoding Locations - example

Trang 34

Geocoding Locations - example

Trang 35

Mapping Locations

P à2.3

Trang 37

Google Maps bên ngoài

Trang 38

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

Trang 40

 Trong AndroidManifest.xml, n <application>, à

sung thêm các dòng sau:

android:value="KEY"/>

android:value="@integer/google_play_services_version" />

Ngày đăng: 09/08/2021, 17:36

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm