Time of Update: 2018-12-05
/*** 得到位置資訊*/private void getLocation() {// 擷取位置管理服務LocationManager locationManager;String serviceName = Context.LOCATION_SERVICE;locationManager = (LocationManager) this.getSystemService(serviceName);// 尋找到服務資訊Criteria criteria = new
Time of Update: 2018-12-05
I found a solution which work for me, I check the source code of class WebView in 2.3 API and find how to do it with a 2.1 API. Maybe it can work with older API:public class CustomWebView extends WebView { private float oldX; // indicate if
Time of Update: 2018-12-05
MainActivity如下:package cc.testservice3;import android.os.Bundle;import android.app.Activity;import android.content.Intent;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;/** * Demo描述: * IntentService的使用
Time of Update: 2018-12-05
MainActivity如下:package cc.testservice2;import android.app.Activity;import android.content.ComponentName;import android.content.Intent;import android.content.ServiceConnection;import android.os.Bundle;import android.os.IBinder;import
Time of Update: 2018-12-05
通過Socket +
Time of Update: 2018-12-05
模板方法(Template Method)模式是GOF設計模式中最為常見幾個模式之一。現在流行的很多架構中(如Spring,struts等),我們都可以看到模板方法模式的廣泛應用。模板方法模式主要應用於架構設計中,在日常的應用設計中也被經常使用。 可是,我們在運用模板方法模式來解決我們的需求而進行設計時,往往忽略了一些非常重要的細節。保證架構邏輯的正常執行,不被子類破壞;怎麼讓子類擴充模板方法等。 1. 模板方法設計模式的意圖
Time of Update: 2018-12-05
因為需求,我需要獲得viewpager當前的view於是我採用以下寫法View currentView = mViewPager.getChildAt(mViewPager.getCurrentItem());然後我拿這個view去做其他的事,但是滑動超過3個view後,再拿這個view的時候發現是null, mViewPager.getCurrentItem()超過2時就是null了, 這說明viewpager是三個view重複利用那怎麼辦呢?轉載請註明出處:http://blog.csdn.
Time of Update: 2018-12-05
歡迎轉帖,但請註明地址:http://blog.csdn.net/ethan_xue/ 謝謝最近因為項目需要,更改EditText被選中時的圖片,網路搜尋未果,於是查看原始碼EditText代碼裡沒什麼東西,於是猜測在其父類TextView中,很快發現這樣一段代碼 int mTextSelectHandleLeftRes; int mTextSelectHandleRightRes; int mTextSelectHandleRes; Drawable
Time of Update: 2018-12-05
1.Android-Universal-Image-Loaderhttps://github.com/nostra13/Android-Universal-Image-Loader推薦使用,可以在很大程度上避免圖片的oom 2.afinalhttps://github.com/yangfuhai/afinal個人認為bug超多,圖片部分是封裝的google的官網代碼,使用簡便了,但是bug多了,不建議使用,希望作者繼續努力,修複的更好一些ps:作者已更新為軟引用,減少記憶體崩潰,有興趣的童鞋可以
Time of Update: 2018-12-05
* * 擷取當前的手機號 */ public String getLocalNumber() { Context context = getApplicationContext(); TelephonyManager tManager = (TelephonyManager)context.getSystemService(TELEPHONY_SERVICE);
Time of Update: 2018-12-05
轉:http://www.androidin.com/thread-876-1-1.html Android 網站資源收集大全(不斷更新中)Android 網站資源收集大全(不斷更新中)Android開發人員論壇http://www.androidin.com/google主站:http://code.google.com/android/E文文檔http://code.google.com/android/documentation.htmlAndroid中國開發人員團隊google
Time of Update: 2018-12-05
http://chroya.iteye.com/blog/761441 Android中有Context的概念,想必大家都知道。Context可以做很多事情,開啟activity、發送廣播、開啟本包下檔案夾和資料庫、擷取classLoader、擷取資源等等。如果我們得到了一個包的Context對象,那我們基本上可以做這個包自己能做的大部分事情。 那我們能得到嗎?很高興的告訴你,能!
Time of Update: 2018-12-05
對圖片本身進行操作。盡量不要使用setImageBitmap、setImageResource、BitmapFactory.decodeResource來設定一張大圖,因為這些方法在完成decode後,最終都是通過java層的createBitmap來完成的,需要消耗更多記憶體。因此,改用先通過BitmapFactory.decodeStream方法,建立出一個bitmap,再將其設為ImageView的source,decodeStream最大的秘密在於其直接調用JNI>>nati
Time of Update: 2018-12-05
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" >
Time of Update: 2018-12-05
SharedPreferences是Android平台上一個輕量級的儲存類,主要是儲存一些常用的配置比如視窗狀態,一般在Activity中 重載視窗狀態onSaveInstanceState儲存一般使用SharedPreferences完成,它提供了Android平台常規的Long長 整形、Int整形、String字串型的儲存,它是什麼樣的處理方式呢?SharedPreferences類似過去Windows系統上的ini設定檔,但是它分為多種許可權,可以全域共用訪問,android123提示最
Time of Update: 2018-12-05
mainActivity如下:package c.c;import android.app.Activity;import android.os.Bundle;import android.widget.SlidingDrawer;import android.widget.SlidingDrawer.OnDrawerCloseListener;import android.widget.SlidingDrawer.OnDrawerOpenListener;import
Time of Update: 2018-12-05
mainActivity如下:package cn.testcamera;import java.io.File;import java.text.SimpleDateFormat;import java.util.Date;import android.app.Activity;import android.content.ContentResolver;import android.content.ContentUris;import
Time of Update: 2018-12-05
MainActivity如下:package cn.testhomekey;import android.os.Bundle;import android.app.Activity;import android.content.Intent;import android.content.IntentFilter;/** * Demo描述: * 利用廣播監聽裝置的HOME和RECENT_APPS鍵被按下 * * 參考資料: *
Time of Update: 2018-12-05
MainActivity如下:package cn.testprogressdialog;import android.app.Activity;import android.app.Dialog;import android.content.Context;import android.content.DialogInterface;import android.content.DialogInterface.OnCancelListener;import android.os.Bundle;
Time of Update: 2018-12-05
<?xml version="1.0" encoding="UTF-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"><!-- Tween Animation:通過對情境裡的對象不斷做映像變換(平移、縮放、旋轉)產生動畫效Alpha:漸層透明度動畫效果Scale:漸層尺寸伸縮動畫效果Translate:畫面轉換位置移動動畫效果Rotate:畫面旋轉動畫效果Tween