Skip to content

Instantly share code, notes, and snippets.

– Makefile (全局的Makefile文件)
– bionic (Bionic含义为仿生,这里面是一些基础的C库源代码)
– bootloader (引导加载器)
build目录中的内容不是目标所用的代码,而是编译和配置所需要的脚本和工具)
– build (build目录中的内容不是目标所用的代码,而是编译和配置所需要的脚本和工具)
– cts (Android兼容性测试套件标准)
– libcore (核心库相关)
Dalvik虚拟机 针对嵌入式设备优化的Java
Java虚拟机)
– dalvik ( Dalvik虚拟机,针对嵌入式设备优化的Java虚拟机)
/**
* This class holds the per-item data in our Loader.
*/
public static class AppEntry {
public AppEntry(AppListLoader loader, ApplicationInfo info) {
mLoader = loader;
mInfo = info;
mApkFile = new File(info.sourceDir);
}
@twocity
twocity / GetEmail.java
Created April 26, 2013 03:49
How to get the Android device's primary e-mail address
// copy from
// http://stackoverflow.com/a/2175688/1350593
public class ExampleActivity extends Activity implements LoaderManager.LoaderCallbacks<Cursor> {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getLoaderManager().initLoader(0, null, this);
}
@Override
Links&Blogs:
http://developer.android.com/guide/components/index.html
http://developer.android.com/training/index.html
http://www.vogella.com/tutorials.html
http://cyrilmottier.com/
Books:
http://book.douban.com/subject/6902972/
@twocity
twocity / onInterceptTouchEvent.java
Created May 27, 2013 13:47
ViewGroup#onInterceptTouchEvent
/**
* Implement this method to intercept all touch screen motion events. This
* allows you to watch events as they are dispatched to your children, and
* take ownership of the current gesture at any point.
*
* <p>Using this function takes some care, as it has a fairly complicated
* interaction with {@link View#onTouchEvent(MotionEvent)
* View.onTouchEvent(MotionEvent)}, and using it requires implementing
* that method as well as this one in the correct way. Events will be
* received in the following order:
我现在用的是这个:
https://github.com/kevinsawicki/http-request
最近比较热门的有这个:
http://square.github.io/okhttp/
2013 Google I/O讲了一个新的:
https://developers.google.com/events/io/sessions/325304728
https://android.googlesource.com/platform/frameworks/volley/+/master [source code]
http://www.javacodegeeks.com/2013/06/android-volley-library-example.html [example]
@twocity
twocity / LoadMoreListView.java
Created July 19, 2013 15:53
auto loadmore listview
public class LoadMoreListView extends ListView implements OnScrollListener {
private static final String TAG = "LoadMoreListView";
/**
* Listener that will receive notifications every time the list scrolls.
*/
private OnScrollListener mOnScrollListener;
private LayoutInflater mInflater;
/**
* A {@link HttpRequest.ConnectionFactory connection factory} which uses OkHttp.
* <p/>
* Call {@link HttpRequest#setConnectionFactory(HttpRequest.ConnectionFactory)} with an instance of
* this class to enable.
*/
public class OkConnectionFactory implements HttpRequest.ConnectionFactory {
private final OkHttpClient client;
public OkConnectionFactory() {
@twocity
twocity / gist:7297924
Last active December 27, 2015 08:39
android gallery3d source snap
public static String getLocalizedName(Resources res, int bucketId,
String name) {
if (bucketId == MediaSetUtils.CAMERA_BUCKET_ID) {
return res.getString(R.string.folder_camera);
} else if (bucketId == MediaSetUtils.DOWNLOAD_BUCKET_ID) {
return res.getString(R.string.folder_download);
} else if (bucketId == MediaSetUtils.IMPORTED_BUCKET_ID) {
return res.getString(R.string.folder_imported);
} else if (bucketId == MediaSetUtils.SNAPSHOT_BUCKET_ID) {
return res.getString(R.string.folder_screenshot);
@twocity
twocity / AsyncTaskUtil.java
Created November 4, 2013 05:08
an asynctask helper
/*
* Copyright (C) 2012 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software