目前分類:未分類文章 (16)
- Aug 17 Mon 2020 15:19
[登山] 小油坑 → 七星山 → 冷水坑 (幹,假日人有夠多
- Jun 12 Fri 2020 11:08
[沒收到業配食記] 志明牛肉麵-牛肉麵節第三名
在地朋友推薦的牛肉麵店,走到店門口寫著牛肉麵節第三名的招牌。
- Jun 09 Tue 2020 19:22
[沒收到業配食記] 穆記牛肉麵-2019年米其林推薦
清燉半筋半肉麵 230 $$
- Jun 04 Thu 2020 13:03
[運動] 健身之腰閃到
- May 26 Tue 2020 20:13
[減肥] 30天瘦身計畫
起因就是
- Apr 27 Mon 2020 01:51
[Netfelix] 狩獵的時間 [有雷]
- Apr 11 Sat 2020 17:28
[AE] 消失的特效。
- Apr 06 Mon 2020 21:50
[新冠肺炎] 確診人數統計動態圖表
- Oct 05 Thu 2017 10:24
[MAC][去背景]用預覽程式去背景。
- Apr 05 Wed 2017 11:59
如果你要學第一個程式語言,推薦不要先學 Java-Android
以現在這個環境,個人比較推薦學習Js之類的直譯語言。
不是因為職業考量,而是你如果學習Java-Android的話,你會花很多時間在等待編譯,打包之類的,改一行有時候要等很久才能驗證。
- Nov 21 Mon 2016 11:29
Android-利用adb指令printscreen
- Feb 15 Sat 2014 10:40
Android-取得資料網址的檔案名稱
- Feb 14 Fri 2014 14:49
Android-Button 按下跟放開的觸發
- Feb 14 Fri 2014 14:41
Android-在layout中add一個View
- Feb 14 Fri 2014 12:47
Android-取得目前所在地的經緯度
這個範例我有放在github專案上歡迎參閱: https://github.com/DeyuGoGo/AndroidBloger package go.deyu.androidbloger; import android.Manifest; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.provider.Settings; import android.support.v4.app.ActivityCompat; import android.view.View; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class MapActivityActivity extends Activity implements View.OnClickListener { /* 記得在你的manifests上增加: <activity android:name=".MapActivityActivity"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 定位需要幾秒,等一下囉。 */ private TextView textView; private TextView textView2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_activity); textView = (TextView) findViewById(R.id.textView); textView2 = (TextView) findViewById(R.id.textView2); findViewById(R.id.button).setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.button: requestUserLocation(); break; } } public void requestUserLocation() { final LocationManager mLocation = (LocationManager) getSystemService(Context.LOCATION_SERVICE); //判斷當前是否已經獲得了定位權限 if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){ Toast.makeText(MapActivityActivity.this,"權限沒開",Toast.LENGTH_SHORT).show(); // 如果是6.0以上的去需求權限 requestCameraPermission(); return; } mLocation.requestSingleUpdate(LocationManager.NETWORK_PROVIDER, new LocationListener() { @Override public void onLocationChanged(final Location location) { final StringBuffer sb = new StringBuffer(); sb.append("Now location is : \n") .append("lat : " + location.getLatitude()).append("\n") .append("lng : " + location.getLongitude()); textView.setText("lat : " + location.getLatitude()); textView2.setText("lng : " + location.getLongitude()); Toast.makeText(MapActivityActivity.this,sb.toString(),Toast.LENGTH_SHORT).show(); } @Override public void onStatusChanged(final String s, final int i, final Bundle bundle) { } @Override public void onProviderEnabled(final String s) { } public void onProviderDisabled(final String s) { } }, MapActivityActivity.this.getMainLooper()); } private void requestCameraPermission(){ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.M) return; final List<String> permissionsList = new ArrayList<>(); if(this.checkSelfPermission(Manifest.permission.CAMERA)!=PackageManager.PERMISSION_GRANTED) permissionsList.add(Manifest.permission.CAMERA); if(this.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)!=PackageManager.PERMISSION_GRANTED) permissionsList.add(Manifest.permission.ACCESS_FINE_LOCATION); if(permissionsList.size()<1) return; if(this.shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)) this.requestPermissions(permissionsList.toArray(new String[permissionsList.size()]) , 0x00); else goToAppSetting(); } private void goToAppSetting(){ Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", this.getPackageName(), null)); startActivityForResult(intent , 0x00); } }
- Feb 13 Thu 2014 17:41
Android-將圖片轉成String By Base64