Time of Update: 2013-12-10
在前文Android定位功能(一)中,已經大致介紹了一下在Android平台中,和定位功能相關的類,並舉例擷取了位置資訊。但是前文是基於Criteria定製了一個標準,通過getBestProvider()方法由Android系統自動擷取最符合Criteria的LocationProvider,從而實現了定位功能。這樣的做法能最大限度的保證定位功能的可實現性,但是卻無法保證擷取到的位置資訊有最大的準確度。因為除了GPS外,其他定位方式都或多或少存在著位置位移。 在實現GPS定位前,先瞭解一下G
Time of Update: 2013-12-10
系統內建的Theme:--------------------------------------------------------------------------------android以及為我們定義好了一些theme,需要是我們直接可以拿來使用。常用的Theme通常如下: android:theme="@android:style/Theme.Dialog"將一個activity顯示為對話方塊模式 android:theme=&qu
Time of Update: 2013-12-10
我們只需要重寫子viewpager 就可以很好的解決這個問題了 /** * ChanpinViewPager.java * com.stg.ln.utils.ui * * Function: TODO * * ver date
Time of Update: 2013-12-10
,返回和菜單鍵是可以直接重寫onKeyDown(int keyCode, KeyEvent event) 方法監聽:@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {if (keyCode == KeyEvent.KEYCODE_BACK) { // 監控/攔截/屏蔽返回鍵//do something} else if (keyCode == KeyEvent.KEYCODE_MENU) {//do
Time of Update: 2013-12-10
下面是一個簡單的json 解析的demo,廢話不多說,直接上代碼 package com.sky.gallery;import java.io.ByteArrayOutputStream;import java.io.DataInputStream;import java.io.IOException;import java.io.InputStream;import
Time of Update: 2013-12-10
網路操作是進行網路通訊的安卓程式必不可少的一個重要部分,Android平台有三種網路介面可以使用,他們分別是:java.net.*(標準Java介面)、Org.apache HttpComponents介面和Android.net.*(Android網路介面)。當然還可以使用瀏覽器webkit來進行網路訪問等。其中,前兩個介面可以用來進行http、socket通訊,後一個介面主要是用來判斷安卓裝置網路連接狀況的。所以,本節重點說一下前兩個介面。 1、java.
Time of Update: 2013-12-10
方法一 Timer與TimerTask(Java實現) [java] view plaincopyprint? public class timerTask extends Activity{ private int recLen = 11; private TextView txtView; Timer timer =
Time of Update: 2013-12-10
package com.comnvi.camera;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.text.SimpleDateFormat;import java.util.Date;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import
Time of Update: 2013-12-10
package cn.testreceiveshare1;import java.util.ArrayList;import android.net.Uri;import android.os.Bundle;import android.widget.ImageView;import android.widget.TextView;import android.app.Activity;import android.content.Intent;/** * Demo描述: *
Time of Update: 2013-12-10
Bitmap bit=Reflect3DImage.skewImage(bit, 50);package com.maxway.util; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.Camera; import android.graphics.Canvas; import
Time of Update: 2013-12-10
很多時候,android提供的組件並不能滿足我們的需求,於是我們不得不按需求開發自訂控制項。Step 1. 寫好自訂控制項的內部布局檔案。 <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Time of Update: 2013-12-10
public class ResizeLayout extends FrameLayout { private OnkeyboardShowListener mChangedListener; private boolean misKeyboardshow = false; private RRSharedPreferences preferences; private int keyboardHeight =
Time of Update: 2013-12-10
前幾天做一個小應用,需要用到在service中調用Activity, 但是發現總是出現ANR,百度了下,發現各種說法,不過經過嘗試,發現問題不大,只需要加一句代碼就足夠了,代碼如下: public class XXXService extends Service { public void onCreate() { super.onCreate(); //撥打到電話 Intent call = new Intent(&
Time of Update: 2013-12-10
fillBefore是指動畫結束時畫面停留在此動畫的第一幀;fillAfter是指動畫結束是畫面停留在此動畫的最後一幀。java代碼設定如下:/*****動畫結束時,停留在最後一幀*********setFillAfter(true);setFillBefore(false); /*****動畫結束時,停留在第一幀*********setFillAfter(false);setFillBefore(true); xml設定如下:/*****
Time of Update: 2013-12-10
import android.annotation.SuppressLint;import android.content.Context;import android.view.View;import android.widget.Toast;public class ToastUtil {private static Toast toast;private static View view;private ToastUtil()
Time of Update: 2013-12-10
1 xml <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
Time of Update: 2013-12-10
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.view.View;import
Time of Update: 2013-12-10
<!-- android:shadowDx 陰影的水平位移量 即往右移的距離 --> <!-- android:shadowDy 陰影的垂直位移量 即往下移的距離--> <!-- android:shadowColor 陰影顏色 --> <!-- android:shadowRadius 陰影的範圍 即陰影透明和擴散的程度--> <style name="textViewStyle">
Time of Update: 2013-12-10
主介面上是兩個EditText和一個按鈕。用於輸入兩個數字參數。calcute.xml: <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
Time of Update: 2013-12-10
最近做項目需要一個拍照後,將圖片上傳到伺服器的功能,並且伺服器是cs的webservice寫的,通常我們調用webservcie通訊都是傳遞xml或者json格式的字串。從來沒傳過圖片這樣的檔案。百度了很多方法,最後使用了從android端用io流讀取到要上傳的圖片,用Base64編碼成位元組流的字串,通過調用webservice把該字串作為參數傳到伺服器端,服務端解碼該字串,最後儲存到相應的路徑下。整個上傳過程的關鍵就是 以 位元組流的字串