随笔分类 - android
涉及开放方面的心得。
摘要:在Android内部有一套自己图片处理的机制,类似android.graphics.Canvas等等,使用它足以完成标题中的任务。首先,我们要先生成一个Bitmap文件,以此作为画布:Bitmap pic = Bitmap.createBitmap(400, 400, Bitmap.Config.A...
阅读全文
摘要:http://developer.android.com/guide/components/bound-services.htmlBound Services通常是以CS的形式服务的,它一般只在被客户端需要的时候才存活,而不会一直存在于后台。客户端想要绑定必须调用bindService(). 同时必...
阅读全文
摘要:阅读:http://developer.android.com/training/load-data-background/setup-loader.htmlhttp://developer.android.com/training/load-data-background/handle-results.html首先,要实现LoaderManager.LoaderCallbacks。实现该接口的onCreateLoader、onLoadFinished、onLoaderReset。onCreateLoader要返回一个LOADER,官方代码如下:/** Callback that's
阅读全文
摘要:mQueue = Volley.newRequestQueue(getApplicationContext()); //StringRequest四个构造参数分别是Request类型,url,网络请求响应监听器,错误监听器 mQueue.add(new StringRequest(Method.GET, "http://www.baidu.com/", new Listener(){ @Override public void onResponse(String arg0) { // TODO...
阅读全文
摘要:Loaders,获取数据的东西。总体流程是:通过getLoaderManager().initLoader(0,null,this)获得Loader,如果没有,那么就会调用接口函数获取,注意:有ID,所以要在获取的接口函数里进行相应的选择。会自动更新数据;一个主要依赖Activity或者Fragme...
阅读全文
摘要:比起property animation ,View就简单得多了。它提供了大部分的功能,而关于动画的定义,可以是XML或者是CODE,XML移植性较好。XML的标签可以是, , , ,或者是包含起来的, , , 。主要需要注意的是,他的动画可以是同时或者是按顺序来的,只需要在XML里面的startOffset做好设置即可,同时,对于数字的变换(例如直线、二次函数变化等)可以通过interpolator属性来设置。在代码中引用XML动画:ImageView spaceshipImage = (ImageView) findViewById(R.id.spaceshipImage);Animati
阅读全文
摘要:The view animation system provides the capability to only animate View objects, so if you wanted to animate non-View objects, you have to implement your own code to do so. The view animation system is also constrained in the fact that it only exposes a few aspects of a View object to animate, such a
阅读全文
摘要:DPI是每英寸点数。DP单位用于布局排版。记住下面的规范。example:关于字体的颜色和大小。注意字体大小使用sp单位。颜色的推荐:http://developer.android.com/design/style/color.html对于图标的使用,也是很有讲究的,切记不可乱用。http://developer.android.com/design/style/iconography.html
阅读全文
摘要:package com.example.app;import android.os.HandlerThread;import android.os.Message;import android.support.v7.app.ActionBarActivity;import android.support.v7.app.ActionBar;import android.support.v4.app.Fragment;import android.os.Bundle;import android.util.Log;import android.view.LayoutInflater;import
阅读全文
摘要:直接上代码- -package com.example.viewholdtest;import android.content.Context;import android.support.v7.app.ActionBarActivity;import android.os.Bundle;import android.view.LayoutInflater;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.view.ViewGroup;import andr
阅读全文
摘要:首先我们要知道是怎么从C/C++跳到JAVA世界里的。首先,zygote是C世界里从init通过fork出来的一个进程,它执行了它的main,而在main里又很重要地执行了AppRuntime的start(),AppRuntime的start()主要:1、启动了虚拟机以;2、注册了JNI环境;3、利用JNI执行了JAVA类ZygoteInit的main。从此进入了JAVA世界。那么ZygoteInit的main是怎样的?1、它建立了一个IPC的socket通信;2、预加载了资源和类;3、再次fork,新进程就是system_server;4、利用之前建立的socket来进行服务——客户通信。接
阅读全文
摘要:init是安卓也是linux的第一个进程,进程号为1.首先它会先解析init.rc。首先,解析得到的内容会以section为单位,只有On或者是service关键词算是一个section。zygote是一个service section,在这个section里面定义了zygote,系统有一个service结构体来存放service section,service结构体里面包含一个action结构体。解析后service section的执行命令就会被存放在action结构体里面。然后,会通过相关的命令,通过service结构体来实现zygote,一般就是通过fork命令创建进程然后使用exec
阅读全文
摘要:JNI层必须实现为动态库,才能被虚拟机加载并调用,一般命名为:lib模块名_jni.so。JNI的实现有两个点:1、在native方法调用前被加载,一般是在static{}里面使用System.loadLibrary(),动态库名与实际操作的名不一样,因为系统会自动匹配;2、用native声明的函数表示该函数即将会从JNI里完成。(被调用的JNI函数必须先声明,类似C语言)JNI的注册主要是通过方法名字来进行相关联系的,例如如果在android.media.test有一个方法Init(),那么全名就是android.media.test.Init(),在JNI的库函数里,因为“.”有特殊意义所
阅读全文
摘要:目的:大概了解下HAL在android中的作用以及应用,阅读:Android硬件抽象层(HAL)系列文章:http://blog.csdn.net/luoshengyang/article/details/6567257首先作者先自己写了一个虚拟设备,并且为其编写了驱动程序。接下来为了测试写了一个基于C的测试程序。然后接下来的工作都是为了从Application Framework使用JAVA来进行操作。首先,增加硬件抽象层(HAL)模块来访问Linux内核驱动程序;第二,为Android硬件抽象层接口编写JNI方法,以便使得上层的Java应用程序能够使用下层提供的硬件服务;第三,继续网上一层
阅读全文
摘要:阅读:http://www.cnblogs.com/dwj-blog/p/3276937.html
阅读全文
摘要:阅读:http://developer.android.com/training/secure-file-sharing/index.html首先要先注册一个FileProvider。 ... authorities必须是自己程序的包名+fileprovider,resource对应的是下面即将提到的路径问题。 In this example, the tag shares directories within the files/ directory of your app's internal st...
阅读全文
摘要:阅读:http://developer.android.com/training/sharing/index.html最简单的就是用包含ACTION_SEND 的 INTENT了,ACTION_SEND表示不同Activity的交流Intent sendIntent = new Intent();sendIntent.setAction(Intent.ACTION_SEND);sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");sendIntent.setType("text/pla
阅读全文
摘要:阅读:http://www.kuqin.com/shuoit/20131129/336617.html
阅读全文
摘要:阅读:http://developer.android.com/training/gestures/index.html先直接上代码:public class MainActivity extends Activity {...// This example shows an Activity, but you would use the same approach if// you were subclassing a View.@Overridepublic boolean onTouchEvent(MotionEvent event){ int action = ...
阅读全文
摘要:接下来介绍怎么使用Notification。首先需要一个NotificationCompat.Builder ,并使用 A small icon, set by setSmallIcon(),A title, set by setContentTitle(),Detail text, set by setContentText()。除此之外,一般还会为这个通知设置一个Action,即打开一个Activity,通过一个包含了intent的PendingIntent来启动。Intent resultIntent = new Intent(this, ResultActivity.class);..
阅读全文

浙公网安备 33010602011771号