Time of Update: 2018-12-04
android:theme="@android:style/Theme.Dialog" : Activity顯示為對話方塊模式android:theme="@android:style/Theme.NoTitleBar" : 不顯示應用程式標題欄android:theme="@android:style/Theme.NoTitleBar.Fullscreen" : 不顯示應用程式標題欄,並全屏android:theme="Theme.Light ":
Time of Update: 2018-12-04
ConnectivityManager mConnectivity = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);TelephonyManager mTelephony = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE);//檢查網路連接,如果無網路可用,就不需要進行連網操作等 NetworkInfo info =
Time of Update: 2018-12-04
/* * How To Write Faster Loops (after Dan Bornstein, Google Engineer) */ /* 1 ( 最快 ) */for (int i = initializer; i >= 0; i--) { ... } /* 2 第二*/int limit = calculateLoopLimit(); for (int i = 0; i < limit; i++) { ... } /* 3 */Type[]
Time of Update: 2018-12-04
代碼:private MediaPlayer mediaPlayer;mediaPlayer =MediaPlayer.create(context,R.drawable.XXX); Runnable rmp = new Runnable() { public void run() { mediaPlayer01.start(); }};//然後 :final Thread tmp = new Thread(rmp);//再在適當的地方:tmp.start()
Time of Update: 2018-12-04
在這裡, 我將每種動畫分別應用於四個按鈕為例: (1) main.xml 代碼如下:(聲明四個按鈕控制項)XML代碼:<?xml version="1.0"
Time of Update: 2018-12-04
android:launchMode="singleTask" 和 onNewIntent(Intent intent)兩個特性,現總結一下經驗:android:launchMode="singleTask" 配置在 Mainifest 中,它保證了棧中此Activity總是只有一個,無論你啟動它多少次;onNewIntent(Intent intent) 是Override
Time of Update: 2018-12-04
在進行android開發時,每個Activity會預設帶上一個title bar用以顯示程式名,有時為了擴大螢幕的顯示地區需要去掉這個title bar,去掉螢幕上的title bar有3個方法,第一個方法是在代碼去掉title bar在Activity的onCreate中加入如下代碼:Java代碼
Time of Update: 2018-12-04
通過Android系統提供的介面,可以很方便的管理連絡人資訊。一、添加1、新增連絡人...1.6上的代碼:String peopleName = "name";ContentValues personValues = new ContentValues();// namepersonValues.put(Contacts.People.NAME, peopleName);/* STARRED 0 = Contacts, 1 = Favorites
Time of Update: 2018-12-04
因為發現光調用finish()方法後 程式中所啟動的線程依舊在後台運行 Android的特點之一 否則也不會出現諸多用於關閉進程的工具 我分別使用了2種可以用於完全關閉進程的方式 第一種方式 Java代碼 android.os.Process.killProcess(android.os.Process.myPid()); 另一種 Java代碼 System.exit(0); 可以寫在onDestory方法中 第三種 final ActivityManager am =
Time of Update: 2018-12-04
1.從google搜尋內容Intent intent = new Intent();intent.setAction(Intent.ACTION_WEB_SEARCH);intent.putExtra(SearchManager.QUERY,"searchString")startActivity(intent);2.瀏覽網頁Uri uri = Uri.parse("http://www.google.com");Intent it = new
Time of Update: 2018-12-04
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"
Time of Update: 2018-12-04
1、定義style:<resources> <style name="dialog_fullscreen"> <item name="android:windowFullscreen">true</item> <item name="android:windowNoTitle">true</item> <item
Time of Update: 2018-12-04
package net.android.touming;import android.widget.TextView;import android.os.Bundle;import android.view.ViewGroup;import android.app.Activity;import android.graphics.Color;import android.widget.LinearLayout;public class touming extends Activity
Time of Update: 2018-12-04
斷點續傳下載,其實就是記錄下原來下載的位置,然後從那個位置開始下載就是了。代碼如下。/** * 作用:斷點續傳下載<BR> * 作者:peijiangping<BR> * 日期:2011-6-11 */public static int doDownloadTheFile_test(String strPath, String filePath,String filename, int mode, long size, Handler handler)
Time of Update: 2018-12-04
在開發Android和iPhone應用程式時,我們往往需要從伺服器不定的向手機用戶端即時推送各種通知訊息,iPhone上已經有了比較簡單的和完美的推播通知解決方案,可是Android平台上實現起來卻相對比較麻煩,最近利用幾天的時間對Android的推播通知服務進行初步的研究。在Android手機平台上,Google提供了C2DM(Cloudto Device Messaging)服務,起初我就是準備採用這個服務來實現自己手機上的推送功能。Android Cloud to Device
Time of Update: 2018-12-04
本來想發圖片的,可是太笨了不會發哇。。個人化的listview 方法有很多,我還是喜歡自訂adapter 因為看起來比較條理清晰。首先你要建立你的listview <ListView android:layout_width="fill_parent" android:cacheColorHint="#00000000" android:id="@layout/userone" android:dividerHeight="0.5dip" android:layout_
Time of Update: 2018-12-04
在Android中錄音可以用MediaRecord錄音,操作比較簡單。但是不夠專業,就是不能對音頻進行處理。如果要進行音訊即時的處理或者音訊一些封裝就可以用AudioRecord來進行錄音了。這裡給出一段代碼。實現了AudioRecord的錄音和WAV格式音訊封裝。用AudioTrack和AudioTrack類可以進行邊錄邊播,可以參考:http://blog.sina.com.cn/s/blog_6309e1ed0100j1rw.html我們這裡的代碼沒有播放。但是有封裝和詳解,如下:pack
Time of Update: 2018-12-04
目前即時抓取手機視頻資料有2種方法,一種是通過camera的回調擷取來源資料,這裡擷取的來源資料是沒有編碼的資料。有的人發送yuv資料然後在那繪製圖片,也說視訊交談,真是可笑。這種方式是可是實現視訊交談的,但是需要移植編碼庫目前可移植的有,android的opencore編碼,參考http://www.shouyanwang.org/thread-184-1-1.html。ffmpeg編碼,這個網上很難找,但是也有人實現哦。(編碼效率好,但是支援不了高清視頻)編碼完成可以通過rtp協議發送。就可
Time of Update: 2018-12-04
寫一個簡訊監聽程式,大家很容易想到的就是註冊一個廣播接收器,來接收系統收到簡訊時候的廣播。可是這個廣播是有序廣播,就是當別的程式先擷取到了這個廣播再傳遞給你,當然它也可以幹掉這個廣播,讓你接收不到,這樣你的程式肯定是接收不到這個廣播的了。網上有很多這樣的例子,什麼提高廣播接收器的優先順序又是1000又是10000的。。大家可以看看這個廣播的基本介紹:http://wenku.baidu.com/view/226f9dd5b14e852458fb57ba.html這裡提到了把intent-filt
Time of Update: 2018-12-04
代碼如下:package com.pei.activity;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.TextView;/** * class