Time of Update: 2018-12-04
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *
Time of Update: 2018-12-04
ndroid 對中文字型支援很不好~~ 需要加入相應的字型庫(1)建立布局Layout//建立線性布局 LinearLayout
Time of Update: 2018-12-04
集合了gps、wifi、基站定位。其中GPS定位首先是GpsTask類非同步返回GPS經緯度資訊GpsTask gpstask = new GpsTask(GpsActivity.this,new GpsTaskCallBack() { @Override public void gpsConnectedTimeOut() {
Time of Update: 2018-12-04
String fileName = "/sdcard/TestB.apk"; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" +new File(fileName)),"application/vnd.android.package-archive"); startActivity(intent); 1、安裝apkString
Time of Update: 2018-12-04
添加系統jar、和第三方的jar檔案說明1,常見的應用開發需要用到FRAMEWORK中的資源,就需要將/home/lsj/android/full_src/out/target/product/.../system/framework/下面的 framework.jar和service.jar放入到工程的建立檔案夾lib裡面,然後選中添加的JAR檔案,右鍵到BUILD PATH "" 然後ADD TO PATH就將jar添加到工程裡面了2.有時需要部分Framework資源,只需要將out
Time of Update: 2018-12-04
JAVA_HOME=/usr/local/jdk1.5CLASSPATH=.:$JAVA_HOME/bin:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jarANDROID_SDK_HOME=/home/lsj/tools/android-sdk/platform-toolsPATH=.:$CLASSPATH:$PATH:$/home/lsj/android/bin:$ANDROID_SDK_HOME1.安裝git># sudo apt-get
Time of Update: 2018-12-04
android 幾種DIALOG 都是繼承DIALOG,所以重寫DIALOG很有好處,實現如下:1,在STYEL。XML中實現樣式定義 them.xml <style name="dialog" parent="@android:style/Theme.Dialog"> <item name="android:windowNoTitle">true</item> <!-- <item
Time of Update: 2018-12-04
package com.android.menu;import android.app.Activity;import android.content.Context;import android.graphics.drawable.BitmapDrawable;import android.os.Bundle;import android.util.Log;import android.view.Gravity;import
Time of Update: 2018-12-04
1.imagebutton.setOnTouchListener(new OnTouchListener() { int[] postion = new int[] { 0, 0 }; @Override public boolean onTouch(View v, MotionEvent event) { int x = (int) event.getRawX();
Time of Update: 2018-12-04
1.初始化 Context mContext = SDMusicPlayBackActivity.this; LayoutInflater mLayoutInflater = (LayoutInflater) mContext .getSystemService(LAYOUT_INFLATER_SERVICE); mSeekView = mLayoutInflater.inflate(R.layout.pop_seek,
Time of Update: 2018-12-04
這篇文章會介紹如何新增資料到sqllite database,並在database作查詢等動作上一篇已經介紹如何在sd card新增資料庫這裡就只略過如何新增資料庫,直接說明新增and查詢的動作public class db_sample { public static final String STR_TABLE_NAME = "table_name"; //table名稱 public static final String STR_FIELD_ID = "field_id";
Time of Update: 2018-12-04
今天在遇到一個非常需求的一個問題,需要在listview上面的headview 加上一個可以滾動切換圖片的畫面接著就開始使用 scorller and VelocityTracker 實現,但是在滑動headview的時候,出現了情況 是:scorller 滑動時候,touch down 和touch move 都執行成功了,但是不見touch up訊息回來所以就感覺到很奇怪,開始認為是listview
Time of Update: 2018-12-04
以下ACTION只能在Java代碼中使用Context.registerReceiver()方法註冊,否則將收不到。ACTION_SCREEN_ON/OFF如果需要的話,就要釋放許可權,釋放許可權代碼在FRAMEWORK中的services/java/com/android/server/PowerManagerService.java mScreenOnIntent = new Intent(Intent.ACTION_SCREEN_ON);
Time of Update: 2018-12-04
如代碼所示,2的速度明顯快好幾倍public void getContact(Context con){Cursor cursor=con.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,PROJECTION,null,null, QUERY_ORDER_BY_NAME);if (cursor != null) {try {List<UContact> uContacts = new
Time of Update: 2018-12-04
在Android源碼編譯成功的基礎上重新編譯帶自己API的android.jar需要進行以下幾步操作。 1 添加自己原始碼,在Android源碼frameworks/base目錄下建立一個檔案夾儲存代碼,如tv,以包的形式命名添加的檔案所在的路徑,如/tv/java/android/tv,添加的java檔案開頭定義的包即是編譯成功的class檔案所在的包。 2 修改makefile檔案 2.1 修改build/core/pathmap.mk檔案 在FRAMEWORKS_ BASE_
Time of Update: 2018-12-04
/** * 私人構造方法 * * @param activity */ private MySystemParams(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); screenWidth = dm.widthPixels; screenHeight =
Time of Update: 2018-12-04
@Override public boolean onTouchEvent(MotionEvent event) { int height=this.getMeasuredHeight(); final int x = (int) event.getX(); final int y = (int) event.getY(); switch(event.getAction()) { case
Time of Update: 2018-12-04
本文主要介紹記錄和恢複listView滾動位置的3種方法,記錄listView滾動到的位置的座標(推薦)、記錄listView顯示在螢幕上的第一個item的位置、通知適配器資料改變。�0�2有時在view切換時,需要恢複listView之前滾動到的位置,鑒於網上已有資料說的都是第二種方法,而第二種方法本身在精確度上較差,自己找到了第一種方法分享下。�0�21、記錄listView滾動到的位置的座標,然後利用listView.scrollTo精確的進行恢複listView.setOnScrollL
Time of Update: 2018-12-04
<activity>元素的launchMode屬性可以設定四種不同的載入模式:"standard" (預設值) "singleTop" "singleTask"
Time of Update: 2018-12-04
private void loadAllAppsByBatch() { final long t = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0; // Don't use these two variables in any of the callback runnables. // Otherwise we hold a reference to them.