本文整理了Java中android.app.Application.getAssets()
方法的一些代码示例,展示了Application.getAssets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.getAssets()
方法的具体详情如下:
包路径:android.app.Application
类名称:Application
方法名:getAssets
暂无
代码示例来源:origin: Tencent/tinker
@Override
public AssetManager getAssets() {
AssetManager assetManager = super.getAssets();
if (applicationLike != null) {
return invokeAppLikeGetAssets(applicationLike, assetManager);
}
return assetManager;
}
代码示例来源:origin: bumptech/glide
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
loader = new AssetUriLoader<>(RuntimeEnvironment.application.getAssets(), factory);
}
代码示例来源:origin: commonsguy/cw-omnibus
in=app.getAssets().open(ASSET_FILENAME);
代码示例来源:origin: westnordost/StreetComplete
@Provides public AssetManager assetManager()
{
return application.getAssets();
}
代码示例来源:origin: weexteam/weex-hackernews
private static void loadFromAsset(FontDO fontDo,String path){
try {
Typeface typeface = Typeface.createFromAsset(WXEnvironment.getApplication().getAssets(), path);
if (typeface != null) {
if(WXEnvironment.isApkDebugable()) {
WXLogUtils.d(TAG, "load asset file success");
}
fontDo.setState(FontDO.STATE_SUCCESS);
fontDo.setTypeface(typeface);
} else {
WXLogUtils.e(TAG, "Font asset file not found " + fontDo.getUrl());
}
} catch (Exception e) {
WXLogUtils.e(TAG, e.toString());
}
}
代码示例来源:origin: stephanenicolas/toothpick
@Override
public AssetManager get() {
return application.getAssets();
}
}
代码示例来源:origin: roomanl/AndroidDownload
@Override
public AssetManager getAssets() {
return app.getAssets();
}
代码示例来源:origin: ydcx/KooReader
public AssetManager getAssets() {
return myApplication.getAssets();
}
代码示例来源:origin: adolfAn/FBReader_AS
public AssetManager getAssets() {
return myApplication.getAssets();
}
代码示例来源:origin: Jiangzqts/EpubRead
public AssetManager getAssets() {
return myApplication.getAssets();
}
代码示例来源:origin: mapsforge/mapsforge
@Override
public InputStream platformSpecificSources(String relativePathPrefix, String src) throws IOException {
// this allows loading of resource bitmaps from the Android assets folder
String pathName = (TextUtils.isEmpty(relativePathPrefix) ? "" : relativePathPrefix) + src;
try {
return this.application.getAssets().open(pathName);
} catch (IOException e) {
throw new FileNotFoundException("invalid resource: " + pathName);
}
}
代码示例来源:origin: youxin11544/RxJava_Simple
public static String get(String fileName) {
InputStream is = null;
try {
is = UtilsCollection.core.getAssets().open(fileName);
int lenght = is.available();
byte[] buffer = new byte[lenght];
is.read(buffer);
String result = new String(buffer, "utf8");
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
代码示例来源:origin: Jiangzqts/EpubRead
@Override
public InputStream getInputStream() throws IOException {
return myApplication.getAssets().open(getPath());
}
代码示例来源:origin: adolfAn/FBReader_AS
@Override
public InputStream getInputStream() throws IOException {
return myApplication.getAssets().open(getPath());
}
代码示例来源:origin: ydcx/KooReader
@Override
public InputStream getInputStream() throws IOException {
return myApplication.getAssets().open(getPath());
}
代码示例来源:origin: commonsguy/cw-androidarch
private InputStream open(Uri uri) throws IOException {
String scheme=uri.getScheme();
String path=uri.getPath();
if ("file".equals(scheme) && path.startsWith("/android_asset")) {
return(ctxt.getAssets().open(ASSET_FILENAME));
}
ContentResolver cr=ctxt.getContentResolver();
cr.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
return(cr.openInputStream(uri));
}
代码示例来源:origin: gdpancheng/LoonAndroid3
public static Properties loadConfigAssets(String fileName) {
Properties properties = new Properties();
try {
InputStream is = Ioc.getIoc().getApplication().getAssets().open(fileName);
properties.load(is);
} catch (Exception e) {
Ioc.getIoc().getLogger().e(e.toString());
}
return properties;
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
packageIdentifiers = hackAssetManager.getAssignedPackageIdentifiers();
HackAssetManager hackhostAssetManager = new HackAssetManager(FairyGlobal.getHostApplication().getAssets());
SparseArray<String> hostPackageIdentifiers = hackhostAssetManager.getAssignedPackageIdentifiers();
printPackages(hostPackageIdentifiers);
代码示例来源:origin: ydcx/KooReader
private long sizeInternal() {
try {
AssetFileDescriptor descriptor = myApplication.getAssets().openFd(getPath());
// for some files (archives, crt) descriptor cannot be opened
if (descriptor == null) {
return sizeSlow();
}
long length = descriptor.getLength();
descriptor.close();
return length;
} catch (IOException e) {
return sizeSlow();
}
}
代码示例来源:origin: adolfAn/FBReader_AS
private long sizeInternal() {
try {
AssetFileDescriptor descriptor = myApplication.getAssets().openFd(getPath());
// for some files (archives, crt) descriptor cannot be opened
if (descriptor == null) {
return sizeSlow();
}
long length = descriptor.getLength();
descriptor.close();
return length;
} catch (IOException e) {
return sizeSlow();
}
}
内容来源于网络,如有侵权,请联系作者删除!