目前分類:來玩Android (56)
- Jun 28 Wed 2017 15:41
[Android] getApplication()、getApplicationContext()、getBaseContext()、MainActivity.this、this、getContext()之間的區別
- Jun 26 Mon 2017 20:43
[Android] andorid專案資料夾用途說明
使用Android Studio開啟一個新專案,它會預設幫你建立幾個資料夾,用處說明如下
manifests 記錄應用程式的細節定義,資料夾裡面會有個AndroidManifest.xml,內容包含套件名稱,元件名稱及權限設定等
- Jun 07 Wed 2017 08:59
[Android] Android keyboard(Kye value)(KeyEvent) 的 ASCII對應值
資料來源 http://jashliao.pixnet.net/blog/post/222652314 https://developer.android.com/reference/android/view/KeyEvent.html
Summary
- Feb 22 Wed 2017 18:23
[Android] android擷取鏡頭錄影並利用FFmpeg rtmp輸出Live頻道 sample code
參考自 https://github.com/vanevery/JavaCV_0.3_stream_test
參考自 https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java
- Oct 30 Fri 2015 11:55
[Android] Android多國語言APP的做法及資料夾命名
- Oct 30 Fri 2015 10:00
[Android] Android中的EditText如何判斷是否為空值
Android中如果需要與使用者互動或者儲存輸入資料時,通常會用EditText這個元件來達成.
但這就牽扯到了一些問題,如果使用者沒有按照規劃輸入應該輸入的資料時,你的APP要怎麼反應呢??
- Oct 28 Wed 2015 15:38
[Android] 將SQLite查詢到的資料顯示在listview上
lv1 = (ListView)findViewById(R.id.lv1);
db = openOrCreateDatabase("db1.db",MODE_PRIVATE,null);
- Oct 19 Mon 2015 22:38
[Android] Android的資料儲存-SQLite的使用
建立Database
SQLiteDatabase db = openOrCreateDatabase("mydb.db",MODE_PRIVATE,null); 第二個參數可以用 MODE_PRIVATE MODE_WORLD_READABLE MODE_WORLD_WRITEABLE
刪除Database
- Oct 19 Mon 2015 20:12
[Android] Android的資料儲存-SDcard的讀寫
權限的開放,在AndroidManifest.xml加入
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- Oct 19 Mon 2015 18:40
[Android] 顯示SDcard的Path
MainActivity.java
package tw.idv.charleslin74.sdcardreadwritetest; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView showerror = (TextView) findViewById(R.id.showerror); String aaa = Environment.<em>getExternalStorageDirectory</em>().getPath(); showerror.setText(aaa); } }
activity_main.xml
- Oct 13 Tue 2015 21:18
[Android] Android的資料儲存-FileOutputStream及FileInputStream的使用
寫入資料
FileOutputStream fout = openFileOutput("myfile.txt",MODE_PRIVATE); BufferedOutputStream buffout = new BufferedOutputStream(fout); buffout.write("這是測試".getBytes()); buffout.close();
讀取資料
- Oct 13 Tue 2015 13:22
[Android] Android的資料儲存-SharedPreferences的使用
寫入資料
SharedPreferences spToDo = getSharedPreferences("prefile",MODE_PRIVATE); spToDo.edit().putString("username","superman").commit();
放進資料的方式有putBoolean,putFloat,putInt,putLong,putString,依需求自已改變.
- Sep 29 Tue 2015 21:45
[Android] android顯示連線類型3G or WIFI
- Sep 27 Sun 2015 21:49
[Android] 監聽返回鍵,按下時跳出確認視窗
package com.example.charleslin.keybackalarm;
- Sep 27 Sun 2015 21:24
[Android] 當顯示內容超過一個頁面時,使用ScrollView
- Sep 27 Sun 2015 19:43
[Android] Android取得螢幕大小值
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- Sep 24 Thu 2015 15:17
[Android] Android簡易網路影音頻道播放m3u8
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.charleslin.playlivevideo" > <uses-permission android:name="android.permission.INTERNET" > </uses-permission> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="orientation|screenSize" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".VideoViewActivity" android:configChanges="orientation|screenSize" > </activity> </application> </manifest>
MainActivity.java
- Sep 24 Thu 2015 14:55
[Android] Android device rotate(landscape portrait) 導致APP刷新
如果你的APP是一個靜態頁面的話,它想刷新就讓它刷新,但是如果你頁面的資料是來自網路上或者你正在看影片聽音樂,轉個螢幕就重新看重新聽,你不被使用者打死才怪.
那為什麼轉個螢幕就必須重新開始呢??
- Sep 17 Thu 2015 22:38
[Android] JSON的介紹及取值的方法
基本的JSONObject,key和value間是用:隔開的
{"door":"red"}
- Sep 13 Sun 2015 15:19
[Android] Android讀取JSON URL
AndroidManifest.xml裡要開放對INTERNET的存取權限
<?xml version="1.0" encoding="utf-8"?>