1.得到屏幕的screen dimensions
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();int height = display.getHeight();

2. 播放 gif图片在android
@Override protected void onDraw(Canvas canvas) {
canvas.drawColor(0xFFCCCCCC);
Paint p = new Paint();
p.setAntiAlias(true);

canvas.drawBitmap(mBitmap4, 210, 170, null);
mDrawable.draw(canvas);
long now = android.os.SystemClock.uptimeMillis();
if (mMovieStart == 0) { // first time mMovieStart = now; }
if (mMovie != null) {
int dur = mMovie.duration();
if (dur == 0) {
dur = 1000; }
int relTime = (int)((now - mMovieStart) % dur);
mMovie.setTime(relTime);
mMovie.draw(canvas, getWidth() - mMovie.width(),
getHeight() - mMovie.height());
invalidate();
}
}
http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapDecode.html
@Override
protected void onDraw(Canvas canvas) {
if(movie != null) {
long now = android.os.SystemClock.uptimeMillis();
int dur = Math.max(movie.duration(), 1);
// is it really animated?
int pos = (int)(now % dur);
movie.setTime(pos);
movie.draw(canvas, x, y);
invalidate();
}}

4. 打开sd卡中的sqllite
File dbfile = new File("/sdcard/mydb.sqlite" );
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(dbfile, null);

5.得到手机的IMEI
((TelephonyManager) getSystemService=(Context.TELEPHONY_SERVICE)).getDeviceId();

6. 不让程序 生成一个appliation 去掉
<category android:name="android.intent.category.LAUNCHER" />
当然你的让你的程序 被引导启动

7.使用appliation 的id 可以获得不同appliation的数据:
android:sharedUserId="string" 在主xml中添加上面一句话,然后签名也要一样 两个app的id也要设置成一样 如都是string 那么这两个程序就可以相互访问彼此的数据,也可以在同一个process中了
8.判断相机设备存在不
private android.hardware.Camera mCameraDevice;
try {
mCameraDevice = android.hardware.Camera.open();}
catch (RuntimeException e) { Log.e(TAG, "fail to connect Camera", e);

9使listView 透明
android:background="#00000000"
android:cacheColorHint="#00000000"
或者
android:background="@android:color/transparent"

•The background android screen image should be visible.
屏幕的背景图像可以看见
manifest file 添加attribute 到 activity.
android:theme="@android:style/Theme.Dialog"

更多相关文章

  1. Android 如何实现屏幕转换方向
  2. android工程下轻松运行java main程序
  3. Android应用程序组件Content Provider的启动过程源代码分析(2)
  4. Android 读取网络数据
  5. Android程序示例
  6. Android英语单词记忆程序源码
  7. android小程序 查询电话号码信息

随机推荐

  1. Android(安卓)自定义圆形进度条 带刻度进
  2. Android Root刷机资源 & Google Nexus资
  3. Gradle依赖总结
  4. andriod cs 架构
  5. Ionic Html5编译IOS Android原生应用
  6. Android(安卓)OpenGLES2.0 渲染ffmpeg解
  7. Android 环境变量访问类
  8. android各个平台区别
  9. Android Studio 实现播放本地/网络视频
  10. android中滑动SQLite数据库分页加载