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
private Bitmap getDefaultBitmap(Bitmap c_org_pic,String str){ int left=0; int length=str.length(); String loc="";//CN try { loc = ActivityManagerNative.getDefault().getConfiguration().locale.getCountry();
Time of Update: 2018-12-04
ndroid 對中文字型支援很不好~~ 需要加入相應的字型庫(1)建立布局Layout//建立線性布局 LinearLayout
Time of Update: 2018-12-04
package com.test;import android.app.Activity;import android.content.Intent;import android.graphics.PixelFormat;import android.os.Bundle;import android.view.Gravity;import android.view.LayoutInflater;import android.view.MotionEvent;import
Time of Update: 2018-12-04
package com.android.api.graphics;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.drawable.Drawable;import android.util.AttributeSet;import android.util.Log;import
Time of Update: 2018-12-04
1.將Launcher2項目匯入eclipse中。這時候Launcher2工程已經匯入到eclipse中了,不過這時候會有100多個錯誤.2.添加Launcher2使用的包檔案。由於在Android源碼中,很多方法、成員、類、包都被打上@hide標籤,這些成員在SDK中沒有公開,以至於在編譯Launcher源碼時最常遇到的類android.view.View的成員mScrollX無法訪問。因此首先需要下載Android的代碼並且編譯好,因為要用到一些編譯完成的class.jar檔案這裡我們用到的
Time of Update: 2018-12-04
Service是android 系統中的一種組件,它跟Activity的層級差不多,但是他不能自己運行,只能後台運行,並且可以和其他組件進行互動。Service的啟動有兩種方式:context.startService()和context.bindService()。 使用context.startService() 啟動Service是會會經曆:context.startService() ->onCreate()- >onStart()->Service
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
case R.id.openPhoto: Intent intent = new Intent(); /* 開啟Pictures畫面Type設定為image */ intent.setType("image/*"); /* 使用Intent.ACTION_GET_CONTENT這個Action */
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
package com.android.tabhost;import android.app.TabActivity;import android.graphics.Color;import android.os.Bundle;import android.util.Log;import android.view.LayoutInflater;import android.widget.TabHost;import
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
<?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
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
package com.cardroid.layer;import android.content.Context;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.graphics.Camera;import android.graphics.Canvas;import android.graphics.Matrix;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
1.ACTIVITY 在XML檔案中要配置如下:其中 <data android:scheme="file"/>標示來自於檔案瀏覽,<data android:scheme="content"/>標示來自於網路 <data android:mimeType="audio/*"/> <data android:mimeType="application/ogg"/> <data