/**
* 从config.xml中获取版本信息以及应用id
*
* @param urlPath
* @return
* @throws Exception
*/
public List getUpdateInfo() {
Resources r = context.getResources();
// 通过Resources,获得XmlResourceParser实例
X...
分类:
移动开发 时间:
2014-12-29 12:10:14
阅读次数:
218
可以在这找到解决方式:http://stackoverflow.com/questions/26797321/not-able-to-convert-zxing-into-portrait-mode-in-android重要的第二步2I在CameraManager类,方法getFramingRect替换intwidth=MIN_FRAME_WIDTH;intheight=MIN_FRAME_HEIGHT;
if(context.getResources().get..
分类:
移动开发 时间:
2014-12-24 18:33:44
阅读次数:
241
public int getResource(String imageName){ Context ctx=getBaseContext(); int resId = getResources().getIdentifier(imageName, "drawable" ...
分类:
移动开发 时间:
2014-12-22 19:33:06
阅读次数:
237
写了个小Demo,实现了设置壁纸和创建桌面图标的逻辑:
创建壁纸比较简单,将Drawable转为Bitmap,然后直接用setWallpaper就行了:
Bitmap bitmap = BitmapFactory.decodeResource(Main.this.getResources(), R.drawable.wallpaper);
try {
...
分类:
移动开发 时间:
2014-12-20 16:59:06
阅读次数:
424
使用 R.. 获取的是资源的一个 id (int 类型), 但有时候我们需要获取资源本身,这时候我们可以通过 Resources 类来完成。 // 使用 Activity 的 getResources() 来获取 Resources 对象 Resources res = ...
分类:
移动开发 时间:
2014-12-19 17:22:02
阅读次数:
130
publicclassGetResIdUtil{publicstaticintgetLayoutId(ContextparamContext,StringparamString){returnparamContext.getResources().getIdentifier(paramString,"layout",paramContext.getPackageName());}publicstaticintgetStringId(ContextparamContext,StringparamString){..
分类:
移动开发 时间:
2014-12-18 06:59:39
阅读次数:
393
以下为Androi内存优化的几种代码处理,示例代码,仅供参考:
?1. 生成Bitmap:
InputStream is =this.getResources().openRawResource(R.drawable.pic1);
BitmapFactory.Options options=newBitmapFactory.Options();
options.inJu...
分类:
移动开发 时间:
2014-12-17 12:47:18
阅读次数:
184
转载自:android获取资源文件 R.drawable中的图片转换为drawable、bitmap1、Resourcesresources=mContext.getResources();Drawabledrawable=resources.getDrawable(R.drawable.a);im...
分类:
移动开发 时间:
2014-12-15 15:00:22
阅读次数:
213
一、android在代码中动态设置字体颜色需要注意的问题。直接这样写是不行的tv.setTextColor(R.color.textColor_black);要从resources中获取tv.setTextColor(this.getResources().getColor(R.color.text...
分类:
移动开发 时间:
2014-12-15 11:52:42
阅读次数:
152
在使用ViewPager常用设置1)mViewPager.setOffscreenPageLimit(2);//设置缓存view 的个数(实际有3个,缓存2个+正在显示的1个)2)mViewPager.setPageMargin((int)getResources().getDimensionPix...
分类:
其他好文 时间:
2014-12-12 10:11:54
阅读次数:
178