android 擷取GPS定位,

/*** 得到位置資訊*/private void getLocation() {// 擷取位置管理服務LocationManager locationManager;String serviceName = Context.LOCATION_SERVICE;locationManager = (LocationManager) this.getSystemService(serviceName);// 尋找到服務資訊Criteria criteria = new

Android 判斷Webview 的水平滾動

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

Android服務(Service)全解析(三)–IntentService

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的使用

Android服務(Service)全解析(二)–bindService

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

Android類比鍵盤滑鼠事件

 通過Socket +

android架構之模板方法模式和策略模式

模板方法(Template Method)模式是GOF設計模式中最為常見幾個模式之一。現在流行的很多架構中(如Spring,struts等),我們都可以看到模板方法模式的廣泛應用。模板方法模式主要應用於架構設計中,在日常的應用設計中也被經常使用。 可是,我們在運用模板方法模式來解決我們的需求而進行設計時,往往忽略了一些非常重要的細節。保證架構邏輯的正常執行,不被子類破壞;怎麼讓子類擴充模板方法等。 1. 模板方法設計模式的意圖

[android] viewpager擷取當前view報null 指標的解決方案

因為需求,我需要獲得viewpager當前的view於是我採用以下寫法View currentView = mViewPager.getChildAt(mViewPager.getCurrentItem());然後我拿這個view去做其他的事,但是滑動超過3個view後,再拿這個view的時候發現是null, mViewPager.getCurrentItem()超過2時就是null了, 這說明viewpager是三個view重複利用那怎麼辦呢?轉載請註明出處:http://blog.csdn.

android 改變TextView和EditText文字選中效果

歡迎轉帖,但請註明地址:http://blog.csdn.net/ethan_xue/   謝謝最近因為項目需要,更改EditText被選中時的圖片,網路搜尋未果,於是查看原始碼EditText代碼裡沒什麼東西,於是猜測在其父類TextView中,很快發現這樣一段代碼 int mTextSelectHandleLeftRes; int mTextSelectHandleRightRes; int mTextSelectHandleRes; Drawable

android 開源組件合集-非UI篇

1.Android-Universal-Image-Loaderhttps://github.com/nostra13/Android-Universal-Image-Loader推薦使用,可以在很大程度上避免圖片的oom 2.afinalhttps://github.com/yangfuhai/afinal個人認為bug超多,圖片部分是封裝的google的官網代碼,使用簡便了,但是bug多了,不建議使用,希望作者繼續努力,修複的更好一些ps:作者已更新為軟引用,減少記憶體崩潰,有興趣的童鞋可以

android 通訊錄的增刪改查

 *         * 擷取當前的手機號         */        public String getLocalNumber() {        Context context = getApplicationContext();                TelephonyManager tManager = (TelephonyManager)context.getSystemService(TELEPHONY_SERVICE);              

Android 網站資源收集大全(不斷更新中)

轉: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

Android擷取其他包的Context執行個體

http://chroya.iteye.com/blog/761441  Android中有Context的概念,想必大家都知道。Context可以做很多事情,開啟activity、發送廣播、開啟本包下檔案夾和資料庫、擷取classLoader、擷取資源等等。如果我們得到了一個包的Context對象,那我們基本上可以做這個包自己能做的大部分事情。         那我們能得到嗎?很高興的告訴你,能!     

android 圖片 記憶體最佳化

對圖片本身進行操作。盡量不要使用setImageBitmap、setImageResource、BitmapFactory.decodeResource來設定一張大圖,因為這些方法在完成decode後,最終都是通過java層的createBitmap來完成的,需要消耗更多記憶體。因此,改用先通過BitmapFactory.decodeStream方法,建立出一個bitmap,再將其設為ImageView的source,decodeStream最大的秘密在於其直接調用JNI>>nati

Android 實現微信聊天一樣的布局

<?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" >

Android SharedPreferences的使用

SharedPreferences是Android平台上一個輕量級的儲存類,主要是儲存一些常用的配置比如視窗狀態,一般在Activity中 重載視窗狀態onSaveInstanceState儲存一般使用SharedPreferences完成,它提供了Android平台常規的Long長 整形、Int整形、String字串型的儲存,它是什麼樣的處理方式呢?SharedPreferences類似過去Windows系統上的ini設定檔,但是它分為多種許可權,可以全域共用訪問,android123提示最

Android抽屜(SlidingDrawer)的實現

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

Android拍照後先剪裁再顯示圖片

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

Android利用廣播監聽按下HOME和RECENT_APPS鍵

MainActivity如下:package cn.testhomekey;import android.os.Bundle;import android.app.Activity;import android.content.Intent;import android.content.IntentFilter;/** * Demo描述: * 利用廣播監聽裝置的HOME和RECENT_APPS鍵被按下 * * 參考資料: *

Android自訂ProgressDialog

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;

android animation的應用執行個體

<?xml version="1.0" encoding="UTF-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"><!-- Tween Animation:通過對情境裡的對象不斷做映像變換(平移、縮放、旋轉)產生動畫效Alpha:漸層透明度動畫效果Scale:漸層尺寸伸縮動畫效果Translate:畫面轉換位置移動動畫效果Rotate:畫面旋轉動畫效果Tween

總頁數: 2771 1 .... 2290 2291 2292 2293 2294 .... 2771 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.