零碎知识点总结

[size=large][size=large][size=small]1.nevigation drawer总结,布局文件
最外面是一个android.support.v4.widget.DrawerLayout,里面两个标签,第一个必须是内容(相当于slidingdrawer的content),第二个是handle(相当于slidingdrawer的handler)顺序不可变。
2.hanler一般为listview或者其他可以选择其中一项的控件。drawLayout可以为其设置打开关闭的监听事件,可以使用android提供的actionbardrawertoggle,或者自己设置监听器,自己实现。
3.实现invalidateoptionsmenu方法后系统会去调用onprepareoptionsmenu方法。其方法内可以对通过oncreateoptionsmenu实现好的menu进行对menu的一些更改,比如可以设置其的可见与不可见状态。
Intent intent=new Intent(Intent.ACTION_QUERY);
intent.putExtra(SearchMnager.SEARCH,Charsequence value);
SearchManger的QUERY的官方解释
[/size]

public static final String QUERY
Added in API level 1
Intent extra data key: Use this key with content.Intent.getStringExtra() to obtain the query string from Intent.ACTION_SEARCH.
Constant Value: "query"
public Intent putExtra (String name, CharSequence value)
Added in API level 1
Add extended data to the intent. The name must include a package prefix, for example the app com.android.contacts would use names like "com.android.contacts.ShowAll".
ParametersnameThe name of the extra data, with package prefix.valueThe CharSequence data value.
Returns
* Returns the same Intent object, for chaining multiple calls into a single statement.

See Also
* putExtras(Intent)
* removeExtra(String)
* getCharSequenceExtra(String)
*

*
if (intent.resolveActivity(getPackageManager())!= null) {
                     startActivity(intent);
                }就是寻找符合条件的componentpublic ComponentName resolveActivity (PackageManager pm)
Added in API level 1
Return the Activity component that should be used to handle this intent. The appropriate component is determined based on the information in the intent, evaluated as follows:
If getComponent() returns an explicit class, that is returned without any further consideration.
The activity must handle the CATEGORY_DEFAULT Intent category to be considered.
If getAction() is non-NULL, the activity must handle this action.
If resolveType(ContentResolver) returns non-NULL, the activity must handle this type.
If addCategory(String) has added any categories, the activity must handle ALL of the categories specified.
If getPackage() is non-NULL, only activity components in that application package will be considered.
If there are no activities that satisfy all of these conditions, a null string is returned.
If multiple activities are found to satisfy the intent, the one with the highest priority will be used. If there are multiple activities with the same priority, the system will either pick the best activity based on user preference, or resolve to a system class that will allow the user to pick an activity and forward from there.
This method is implemented simply by calling resolveActivity(Intent, int) with the "defaultOnly" parameter true.
This API is called for you as part of starting an activity from an intent. You do not normally need to call it yourself.

ParameterspmThe package manager with which to resolve the Intent.
Returns
* Name of the component implementing an activity that can display the intent.
See Also
* setComponent(ComponentName)
* getComponent()
* resolveActivityInfo(PackageManager, int)
* int imageId=imageview.getIdentifier(String name,String defType,String defPack);该方法是通过image的名字,包名,类型,为drawable楼来得到image的资源定位符,暂且这么说吧。但前提是imag的名字与其在drawable文件夹中图片的名字是相同的。
public int getIdentifier (String name, String defType, String defPackage)

Added in API level 1
Return a resource identifier for the given resource name. A fully qualified resource name is of the form "package:type/entry". The first two components (package and type) are optional if defType and defPackage, respectively, are specified here.

Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.

Parameters
name The name of the desired resource.
defType Optional default resource type to find, if "type/" is not included in the name. Can be null to require an explicit type.
defPackage Optional default package to find, if "package:" is not included in the name. Can be null to require an explicit package.
Returns
int The associated resource identifier. Returns 0 if no such resource was found. (0 is not a valid resource ID.)[/size]
[/size]

你可能感兴趣的:(总结)