android中几个很有用的的api

0x0001

public PackageInfo getPackageArchiveInfo (String archiveFilePath, int flags)
Since: API Level 1

Retrieve overall information about an application package defined in a package archive file

Parameters
  • archiveFilePath   The path to the archive file
  • flags Additional option flags. Use any combination of GET_ACTIVITIES,
    GET_GIDS, GET_CONFIGURATIONS, GET_INSTRUMENTATION, GET_PERMISSIONS,
    GET_PROVIDERS, GET_RECEIVERS, GET_SERVICES, GET_SIGNATURES, to modify the
    data returned.

Returns
  • Returns the information about the package. Returns null if the package could not be successfully parsed.

0x0002

public abstract PackageInfo getPackageInfo (String packageName, int flags)
Since: API Level 1

Retrieve overall information about an application package that is installed on the system.

Throws PackageManager.NameNotFoundException if a package with the given name can not be found on the system.

Parameters
  • packageName The full name (i.e. com.google.apps.contacts) of the desired package.

  • flags Additional option flags. Use any combination of GET_ACTIVITIES, GET_GIDS, GET_CONFIGURATIONS,
    GET_INSTRUMENTATION, GET_PERMISSIONS, GET_PROVIDERS, GET_RECEIVERS,
    GET_SERVICES, GET_SIGNATURES, GET_UNINSTALLED_PACKAGES to modify the data returned.

Returns
  • Returns a PackageInfo object containing information about the package. If flag GET_UNINSTALLED_PACKAGES is set and if the package is not found in the list of installed applications, the package information is retrieved from the list of uninstalled applications(which includes installed applications as well as applications with data directory ie applications which had been deleted with DONT_DELTE_DATA flag set).

0x0003

public abstract File getDir (String name, int mode)
Since: API Level 1

Retrieve, creating if needed, a new directory in which the application can place its own custom data files. You can use the returned File object to create and access files in this directory. Note that files created through a File object will only be accessible by your own application; you can only set the mode of the entire directory, not of individual files.

Parameters
  • name Name of the directory to retrieve. This is a directory that is created as part of your application data.

  • mode Operating mode. Use 0 or MODE_PRIVATE for the default operation, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions.
 Returns
  • Returns a File object for the requested directory. The directory will have been created if it does not already exist.

 0x0004

public DexClassLoader (String dexPath, String dexOutputDir, String libPath, ClassLoader parent)
Since: API Level 3

Creates a DexClassLoader that finds interpreted and native code. Interpreted classes are found in a set of DEX files contained in Jar or APK files. The path lists are separated using the character specified by the "path.separator" system property, which defaults to ":".

Parameters
  • dexPath the list of jar/apk files containing classes and resources
  • dexOutputDir directory where optimized DEX files should be written
  • libPath the list of directories containing native libraries; may be null
  • parent the parent class loader 
  

不错的文章:

1、  http://blog.csdn.net/singwhatiwanna/article/details/22597587  关于加载apk中的类和代理实现的一种思路

 

 

转载于:https://www.cnblogs.com/LuLei1990/p/4546387.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值