C50108
Search…
2019/0619/安卓工作室_(硬體裝置與應用)相機操作&GPS+階段性作業6+延伸 ( APP End )

某一些版本的模擬器
實體內部儲存裝置無法寫入
會看不到擷取畫面回傳
必須要用外部儲存裝置儲存影像
開啟 AVD 管理器 進階 SDcard 改為 Extemal file
如果要外鍵SD卡檔案 可以利用 mksdcard 指令
切換到 sdk file emulator
然後就可以把產生的sd卡檔案放進專案的app後用emulator選擇
更改有
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
即可開啟

不管是5.0或6.0 都必須把Loction加入
GetLastKnownLocation 有時無法單獨呼叫
必須 requestLocationupdata
package com.example.application2;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class GPSActivity extends AppCompatActivity implements LocationListener {
private TextView outputTV;
private LocationManager lc;
private Location currentLocation;
private static final int PERMISSIONS_REQUEST_GPS = 101;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gps);
outputTV = findViewById(R.id.lblOutput);
lc = (LocationManager) getSystemService(LOCATION_SERVICE);
if (!lc.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
AlertDialog.Builder builder_AL = new AlertDialog.Builder(this);
builder_AL.setTitle("GPS硬體功能").setMessage("GPS 功能目前狀態尚未啟用。\n請先啟用GPS!!").setPositiveButton("確定",null).create().show();
}
// Android 6.0以上版本的權限管理
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION},PERMISSIONS_REQUEST_GPS);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(requestCode == PERMISSIONS_REQUEST_GPS){
if(grantResults[0] == PackageManager.PERMISSION_GRANTED){
outputTV.setText("取得GPS讀取權限-成功!!");
}
else{
outputTV.setText("取得GPS讀取權限-失敗!!");
}
}
}
@Override
public void onLocationChanged(Location location) {
double lat,lng;
String outputString;
if(location != null){
lat = location.getLatitude();
lng = location.getLongitude();
outputString = "定位提供者 : " + location.getProvider() ;
outputTV.setText( outputString + "\n緯度: " + lat + "\n經度: "+ lng);
currentLocation = location;
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
protected void onPause(){
super.onPause();
try{
lc.removeUpdates(this);
} catch(Exception ex){
outputTV.setText("取消註冊LocationListenerg 失敗 ");
}
}
@Override
protected void onResume(){
super.onResume();
int minDistance = 1 ;
int minTime = 1000;
try{
String s = lc.getBestProvider(new Criteria(), true);
if (s != null){
lc.requestLocationUpdates(s,minTime,minDistance,this);
}else{
outputTV.setText("請確認GPS已開啟");
}
} catch (SecurityException ex) {
outputTV.setText("重新註冊LocationListener失敗");
}
}
public void buttonSetGPS_Click(View view) {
Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(i);
}
public void buttonGetGPS_Click(View v){
double lat ,lng;
String best = lc.getBestProvider(new Criteria(),true);
try{
currentLocation = lc.getLastKnownLocation(best);
if(currentLocation != null){
lat = currentLocation.getLatitude();
lng = currentLocation.getLongitude();
String outputString = "定位提供者 : " + currentLocation.getProvider() ;
outputTV.setText( outputString + "\n緯度: " + lat + "\n經度: "+ lng);
} else {
outputTV.setText("取得GPS 位置失敗!!");
}
} catch (SecurityException ex) {
outputTV.setText("沒有讀取GPS權限,請取得授權 !!");
}
}
public void buttonShowMap_Click(View view) {
double lat ,lng;
lat = currentLocation.getLatitude();
lng = currentLocation.getLongitude();
String label = "車站";
String query = lat + "," + lng + "(" + label + ")";
String uri = "geo:" + lat + "," + lng;
query = Uri.encode(query);
uri = uri + "?q=" + query + "?z=16";
Intent geoMap = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(geoMap);
}
}

座號:08姓名:劉育誠

 利用課堂教學之Android SDK類別,MediaPlayer、VideoView,完成以下程式功能程式之設計,並整合利用Intent物件整合至主畫面:
1. 設計一個「MusicActivity」活動,實作音樂撥放使用者介面,用以提供音樂撥放畫面,並具備基礎之開始撥放、暫停撥放、停止撥放功能。
 需要覆寫「onCompletion」方法,提供結束後重頭開始撥放
 需要實作 button 的 Click事件,提供開始撥放、暫停撥放、停止撥放
 需要覆寫「onDestroy」方法,當活動結束時釋放相關資原
2. 設計一個「VedioActivity」活動,實作影片撥放使用者介面,用以提供視訊撥放畫面,並具備基礎之開始、暫停、停止、快轉、巡覽功能。
 需要使用「VideoView」物件,並取得影片位置,提供撥放功能
 請利用 Uri 物件的parse()方法,提供VideoView物件需求的影片資源
 需要使用「MediaController」物件,提供撥放影片時的控制功能
 需要覆寫「onPause」方法,當活動暫停時停止撥放
3. 設計一個「CameraActivity」活動,配合Intent、模擬器相機,提供照相機使用者介面及基本拍攝、擷取畫面、前後鏡頭轉換功能。
 需要使用「Intent」物件,並配合MediaStore.ACTION_IMAGE_CAPTU RE 動作類型,提供拍攝功能
 請利用ImageView元件,提供拍攝畫面的顯示功能
 需要覆寫「onActivityResult」方法,當內建相機活動傳回影像畫面時,顯示在ImageView元件上
4. 設計一個「GPSActivity」活動,實作衛星定位使用者介面,並提供地圖定位畫面,並具備隨著使用者移動更新GPS座標之功能。
 需要實作「LocationListener」物件,並覆寫相關的方法,例如:「onLocation Changed」,提供更新GPS座標之功能
 使用「Intent」物件,配合Intent.ACTION_VIEW動作類型,呼叫地圖
 需要覆寫「onResume」、「onPause」方法,當活動處於被警狀態時暫停更新定位資料,提供節省耗電功能
結果畫面截圖:
(1) activity_main.xml
(2) activity_music.xml
(3) activity_video.xml
(4) activity_gps.xml
(5) activity_camera.xml
(1)
(2)
(3)
(4)
(5)

(1) AndroidManifest.xml
(2) CameraActivity.java
(3) GPSActivity.java
(4) MainActivity.java
(5) MusicActivity.java
(6) VideoActivity.java
(7) activity_camera.xml
(8) activity_gps.xml
(9) activity_main.xml
(10) activity_music.xml
(11) activity_video.xml
(1)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.application2">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.hardware.camera" />
<uses-permission android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--<activity android:name=".CameraActivity"></activity>-->
<!--<activity android:name=".VideoActivity" />-->
<!--<activity android:name=".MusicActivity" />-->
<!--<activity android:name=".MainActivity" />-->
<!--<activity android:name=".GPSActivity">-->
<activity android:name=".MusicActivity"></activity>
<activity android:name=".VideoActivity" />
<activity android:name=".CameraActivity" />
<activity android:name=".GPSActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
(2)
package com.example.application2;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
public class CameraActivity extends AppCompatActivity {
private ImageView image;
private static final int REQUEST_IMAGE = 100;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);
image = findViewById(R.id.imageView);
}
public void button_Click(View v) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQUEST_IMAGE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if ((requestCode == REQUEST_IMAGE) && (resultCode == Activity.RESULT_OK)) {
Bitmap userImage = (Bitmap) data.getExtras().get("data");
image.setImageBitmap(userImage);
}
}
}
(3)
package com.example.application2;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class GPSActivity extends AppCompatActivity implements LocationListener {
private TextView outputTV;
private LocationManager lc;
private Location currentLocation;
private static final int PERMISSIONS_REQUEST_GPS = 101;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gps);
outputTV = findViewById(R.id.lblOutput);
lc = (LocationManager) getSystemService(LOCATION_SERVICE);
if (!lc.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
AlertDialog.Builder builder_AL = new AlertDialog.Builder(this);
builder_AL.setTitle("GPS硬體功能").setMessage("GPS 功能目前狀態尚未啟用。\n請先啟用GPS!!").setPositiveButton("確定",null).create().show();
}
// Android 6.0以上版本的權限管理
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION},PERMISSIONS_REQUEST_GPS);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(requestCode == PERMISSIONS_REQUEST_GPS){
if(grantResults[0] == PackageManager.PERMISSION_GRANTED){
outputTV.setText("取得GPS讀取權限-成功!!");
}
else{
outputTV.setText("取得GPS讀取權限-失敗!!");
}
}
}
@Override
public void onLocationChanged(Location location) {
double lat,lng;
String outputString;
if(location != null){
lat = location.getLatitude();
lng = location.getLongitude();
outputString = "定位提供者 : " + location.getProvider() ;
outputTV.setText( outputString + "\n緯度: " + lat + "\n經度: "+ lng);
currentLocation = location;
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
protected void onPause(){
super.onPause();
try{
lc.removeUpdates(this);
} catch(Exception ex){
outputTV.setText("取消註冊LocationListenerg 失敗 ");
}
}
@Override
protected void onResume(){
super.onResume();
int minDistance = 1 ;
int minTime = 1000;
try{
String s = lc.getBestProvider(new Criteria(), true);
if (s != null){
lc.requestLocationUpdates(s,minTime,minDistance,this);
}else{
outputTV.setText("請確認GPS已開啟");
}
} catch (SecurityException ex) {
outputTV.setText("重新註冊LocationListener失敗");
}
}
public void buttonSetGPS_Click(View view) {
Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(i);
}
public void buttonGetGPS_Click(View v){
double lat ,lng;
String best = lc.getBestProvider(new Criteria(),true);
try{
currentLocation = lc.getLastKnownLocation(best);
if(currentLocation != null){
lat = currentLocation.getLatitude();
lng = currentLocation.getLongitude();
String outputString = "定位提供者 : " + currentLocation.getProvider() ;
outputTV.setText( outputString + "\n緯度: " + lat + "\n經度: "+ lng);
} else {
outputTV.setText("取得GPS 位置失敗!!");
}
} catch (SecurityException ex) {
outputTV.setText("沒有讀取GPS權限,請取得授權 !!");
}
}
public void buttonShowMap_Click(View view) {
double lat ,lng;
lat = currentLocation.getLatitude();
lng = currentLocation.getLongitude();
String label = "車站";
String query = lat + "," + lng + "(" + label + ")";
String uri = "geo:" + lat + "," + lng;
query = Uri.encode(query);
uri = uri + "?q=" + query + "?z=16";
Intent geoMap = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(geoMap);
}
}
(4)
package com.example.application2;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void btn_activity_music_Click(View view) {
Intent intent = new Intent(this,MusicActivity.class);
startActivity(intent);
}
public void btn_activity_vedio_Click(View view) {
Intent intent = new Intent(this,VideoActivity.class);
startActivity(intent);
}
public void btn_activity_gps_Click(View view) {
Intent intent = new Intent(this,GPSActivity.class);
startActivity(intent);
}
public void btn_activity_camera_Click(View view) {
Intent intent = new Intent(this,CameraActivity.class);
startActivity(intent);
}
}
(5)
package com.example.application2;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MusicActivity extends AppCompatActivity implements MediaPlayer.OnCompletionListener{
private TextView output;
private MediaPlayer player;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_music);
output = findViewById(R.id.lblOutput);
player = MediaPlayer.create(this,R.raw.piano01);
player.setOnCompletionListener(this);
}
@Override
public void onCompletion(MediaPlayer mp) {
output.setText("音樂播放完畢....");
player.seekTo(0);
}
public void button_Click(View v){
if (player != null){
if(player.isPlaying() != true){
player.start();
output.setText("音樂播放中...");
}
}
}
public void button2_Click(View v){
output.setText("音樂暫停播放...");
if (player != null){
player.pause();
}
}
public void button3_Click(View v){
output.setText("音樂停止播放...");
if (player != null){
player.stop();
player.prepareAsync();
}
}
@Override
public void onDestroy(){
super.onDestroy();
if (player != null){
player.release();
}
}
}
(6)
package com.example.application2;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class VideoActivity extends AppCompatActivity {
private VideoView video;
private String videoFile = "point21";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
video = findViewById(R.id.videoView);
// int id = getResources().getIdentifier(videoFile,"raw",this.getPackageName());
int id = R.raw.point21;
String path = "android.resource://" + this.getPackageName() + "/" + id;
video.setVideoURI(Uri.parse(path));
video.setMediaController(new MediaController(this));
video.start();
}
@Override
public void onPause(){
super.onPause();
video.stopPlayback();
}
}
(7)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
>
<Button
android:text="啟動相機照相"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/button"
android:onClick="button_Click" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/imageView"
android:scaleType="fitCenter"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
(8)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GPS資訊:"
android:layout_margin="10dp"
android:id="@+id/lblOutput"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="設定GPS"
android:layout_margin="10dp"
android:id="@+id/buttonSetGPS"
android:onClick="buttonSetGPS_Click"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="取得GPS座標"
android:layout_margin="10dp"
android:id="@+id/buttonGetGPS"
android:onClick="buttonGetGPS_Click"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="顯示Google地圖"
android:layout_margin="10dp"
android:id="@+id/buttonShowMap"
android:onClick="buttonShowMap_Click"
/>
</LinearLayout>
(9)
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
>
<TextView
android:id="@+id/text_1"
android:layout_width="match_parent"
android:layout_height="50sp"
android:layout_columnSpan="2"
android:gravity="center"
android:text="階段性作業6"
android:textColor="#000000"
android:textSize="30sp" />
<TextView
android:id="@+id/text_2"
android:layout_width="match_parent"
android:layout_height="50sp"
android:layout_columnSpan="2"
android:gravity="center"
android:text="How To Mack a Good Photo!!"
android:textColor="#000000"
android:textSize="20sp" />
<Button
android:id="@+id/btn_activity_music"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:gravity="center"
android:text="MusicPlayer"
android:textColor="#1D7E38"
android:textSize="20sp"
android:onClick="btn_activity_music_Click" />
<Button
android:id="@+id/btn_activity_vedio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:gravity="center"
android:text="ViedoPlayer"
android:textColor="#66A2AC"
android:textSize="20sp"
android:onClick="btn_activity_vedio_Click" />
<Button
android:id="@+id/btn_activity_gps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:text="GPSLocation"
android:textColor="#9454B6"
android:textSize="20sp"
android:onClick="btn_activity_gps_Click" />
<Button
android:id="@+id/btn_activity_camera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:text="CameraPhoto"
android:textColor="#E07054"
android:textSize="20sp"
android:onClick="btn_activity_camera_Click" />
<ImageView
android:id="@+id/tv_show"
android:layout_width="match_parent"
android:layout_height="200sp"
android:layout_columnSpan="2"
android:layout_gravity="fill"
android:layout_marginLeft="1dp"
android:layout_marginTop="1dp"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"
android:background="#EEEEE0"
android:scaleType="fitXY"
android:src="@drawable/main" />
</LinearLayout>
(10)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
>
<Button
android:text="開始/繼續"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/button"
android:onClick="button_Click" />
<Button
android:text="暫停"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/button"
android:layout_toEndOf="@+id/button"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:id="@+id/button2"
android:onClick="button2_Click" />
<Button
android:text="停止"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/button2"
android:layout_toEndOf="@+id/button2"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:id="@+id/button3"
android:onClick="button3_Click" />
<TextView
android:text="撥放狀態"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="33dp"
android:id="@+id/lblOutput" />
</RelativeLayout>
(11)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="媒體播放器"
android:id="@+id/textView" />
<VideoView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="23dp"
android:id="@+id/videoView" />
</RelativeLayout>
繳交作業時,請以FTP上傳程式原始檔與本文件檔各一份,原始程式碼請另放置在一個資料夾內。
※以上各項均須完成始得通過※

沒講完但有PPT跟書
App課程結束
Copy link
On this page
#Android硬體裝置與應用
##相機操作
##GPS
#作業六
階段性作業6
##指南針 重力加速度裝置 水平儀 資料庫應用等等功能…