PIXNET Logo登入

程式設計@筆記

跳到主文

一個常常忘記code的php工程師寫下的筆記。

部落格全站分類:不設分類

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 4月 07 週五 201714:22
  • [Android] 簡易發送簡訊範例

========================================
activity_main.xml
========================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="傳送到..."
android:id="@+id/to"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="輸入內容"
android:id="@+id/content"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="傳送"
android:id="@+id/send"
/>
</LinearLayout>
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(503)

  • 個人分類:Android
▲top
  • 2月 20 週一 201710:47
  • [Android]讓TextView支援顯示HTML碼

 

textView.setText(Html.fromHtml("HTML碼"));
 
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(62)

  • 個人分類:Android
▲top
  • 2月 20 週一 201710:36
  • [Android] TextView元件,自動判斷新加網址連結 (AutoLink)

<TextView
android:id="@+id/txt_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txt"
android:autoLink="all"
android:layout_below="@+id/txt"
android:text="http://tw.yahoo.com" />
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(76)

  • 個人分類:Android
▲top
  • 2月 15 週三 201715:28
  • [Android]隨機產生陣列假資料

private String[] setdata(int length, String dataname) {
String[] array = new String[length];
for (int i = 0; i < length; i++) {
array[i] = dataname + ":" + i;
}
return array;
}
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(52)

  • 個人分類:Android
▲top
  • 2月 02 週四 201715:05
  • [Android]切換Fragment(新版,取代getFragmentManager)

===============
MainActivity.java
===============
Fragment1 fragment1 = new Fragment1();
getSupportFragmentManager().beginTransaction()
.addToBackStack(null)
.replace(R.id.main_layout, fragment1)
.commit();
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(995)

  • 個人分類:Android
▲top
  • 1月 16 週一 201717:22
  • [Android][函數]透過 InputStreamReader 取得 json字串

public String get_json_string(String urls)
{
StringBuilder sb = new StringBuilder();
try {
URL url = new URL(urls);
BufferedReader in = new BufferedReader(
new InputStreamReader(url.openStream()));
String line = in.readLine();
while(line!=null){
sb.append(line);
line = in.readLine();
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return sb.toString();
}
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(84)

  • 個人分類:Android
▲top
  • 1月 16 週一 201717:14
  • [Android]檢查網路連線狀況

//檢查網路連線狀況
public void chkNet(){
ConnectivityManager connMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected()) {
//Toast.makeText(MainActivity.this, "網路連線中", Toast.LENGTH_SHORT).show();
} else {
//處理確認按鈕的點擊事件
Toast.makeText(MainActivity.this, "網路斷線", Toast.LENGTH_SHORT).show();
}
} // end chkNet
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(104)

  • 個人分類:Android
▲top
  • 1月 13 週五 201715:01
  • [Android]TimePickerDialog設定12小時制與24小時制


例1:12小時制
new TimePickerDialog(this,myTimeSetListener,myHour, myMinute, false);
 
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(97)

  • 個人分類:Android
▲top
  • 1月 13 週五 201711:35
  • [Android]sleep函數,延遲程式執行若干秒

 
try {
Thread.sleep(1000); //1000為1秒
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(4,160)

  • 個人分類:Android
▲top
  • 1月 12 週四 201717:50
  • [Android]使用HttpPost元件,抓網頁範例(網頁顯示的值)

try {
HttpClient client = new DefaultHttpClient();
URI website = new URI("網路URL"); //指定URL
//指定POST模式
HttpPost request = new HttpPost();
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(463)

  • 個人分類:Android
▲top
12»

ad

文章搜尋

熱門文章

  • (12,391)[php] array_push 一個或多個單元加入陣列末尾
  • (1,859)[php]session_save_path 讀取與設置當前會話的保存路徑
  • (1,820)[php]file_put_contents() 函數把一個字符串寫入文件中
  • (1,782)[php]取得使用者IP位置
  • (1,285)[php]imagecolorallocate — 為一幅圖像分配顏色
  • (460)[php]str_split — 將字符串轉換為數組
  • (381)[php] PHP將網址字串轉換成URL
  • (237)php模擬String.TrimEnd函數,移除最後一個逗號或符號
  • (225)[php] array_walk — 對陣列中的每個成員應用用戶函數
  • (97)[php]session_abort 丟棄session陣列的變化和完成session

文章分類

toggle 其它分類 (8)
  • JQuery (16)
  • Android (20)
  • html (7)
  • 其它 (5)
  • codeigniter (13)
  • Mysql (6)
  • javascript (12)
  • css (26)
  • php實用技巧 (17)
  • php常用函數 (44)
  • PDO函數 (36)
  • GD函數 (106)
  • php字符串函數 (70)
  • php陣列 (62)
  • php日期函數 (38)
  • Directory函數 (8)
  • Filesystem函數 (58)
  • Math 函數 (44)
  • json函數 (2)
  • Session 函数 (14)
  • Cookies操作 (7)
  • ftp函數 (20)
  • ctype函數 (8)
  • Misc 雜項函數 (19)
  • cURL 函数 (25)
  • MySQLi函數 (53)
  • SimpleXML函數 (23)
  • Calendar 日曆函數 (17)
  • URL 函數 (10)
  • iconv 函數 (11)
  • Network函數 (24)
  • Multibyte String (45)
  • Zip壓縮函數 (22)
  • Variable handling (28)
  • 未分類文章 (1)

最新文章

  • 解決CKEditor中img標籤自動添加style樣式的問題-禁止自動設置width和height
  • [css]強迫匯出excel的欄位格式轉為純文字
  • [html]使用frame無框轉址
  • [css]解決英文字穿過text-decoration-line底線問題
  • [Jquery]停止所有youtube播放(iframe embed)
  • [Mysql]將字串欄位轉成數字排序或加總金額(使用CAST)
  • [Jquery]讓html檔也能使用include方法
  • [html]textarea預設文字並換行
  • [html5]使用正則 pattern 判斷日期格式
  • [CSS]當文字要壓在圖片上,並作RWD的自適應

文章精選