Snowberg

 

随笔分类 -  Android

1 2 下一页

新建Android项目时使用project from existing source导入已经存在的项目报 AndroidManifest.xml file missing错误解决方案
摘要:出错经过 为了查看<sdk>/platforms/<android-version>/samples/文件夹下的Android自带的经典例子,于是将要看的例子导入到eclipse的workspace当中,在利用eclipse的import功能将项目导入到eclipse,但是报了“no projects found to import”的错误,于是乎使用new->java project->create project from existing source重新导入新数据,这次项目正常导入了,但是报了“AndroidManifest.xml file mis 阅读全文

posted @ 2012-07-27 10:26 Snowberg 阅读(5321) 评论(0) 推荐(0)

Android开发总结
摘要:改变适配器Adapter内容时不要在后台线程中,必须在UI线程中处理,这点可以通过Handler传出来解决。尝试Adapter的notifyDataSetChanged()方法,当然主要看你代码的具体情况。ActivityGroup对子A的管理是通过Map的方式来管理的,在启动子Activity时,对每个子Activity都分配了一个ID号。这种映射的机制使得我们可以通过ID来获取到子A的实例。当遇到AlertDialog.Builder builder = new Builder(this);不显示对话框时,使用AlertDialog.Builder builder = new Builde 阅读全文

posted @ 2012-07-26 21:05 Snowberg 阅读(349) 评论(0) 推荐(0)

ListView中Spinner的使用
摘要:由于项目的需要,要给用户显示一列表单项,让用户选择,之前使用LinerLayout加Button实现,费时费力,而且表现的内容都已经是写好的内容,对于内容可变的情况下,毫无招架之力。因此在新的项目当中使用了向ListView加入Spinner的方式来表现表单。开发过程中遇到些问题。 一、 遇到的问题: 1、对于Spinner状态的保持。 2、对Spinner做了相应事件之后,对于ListView的OnItemClick事件的相应的处理。 二、 问题的解决: 第一个问题在于,ListView侧重于对数据的表现,而对数据的交互方面是比较差的,因为随着ListVie... 阅读全文

posted @ 2012-07-25 16:56 Snowberg 阅读(4993) 评论(0) 推荐(0)

Android统计绘图工具
摘要:下一个项目可能会用到,记录一下。1、chartdroid(http://code.google.com/p/chartdroid/)2、AndroidPlot(http://androidplot.com/wiki/Home)3、AChartEngine(http://code.google.com/p/achartengine/)4、aiCharts(http://www.artfulbits.com/products/android/aicharts.aspx)5、Java4Less (http://www.java4less.com/charts/chart.php?info=andro 阅读全文

posted @ 2012-07-22 22:41 Snowberg 阅读(404) 评论(0) 推荐(0)

listView当中有嵌套了有onClickListener的控件时ListView自身的onItemClick无响应的解决方案
摘要:android:descendantFocusabilityDefines the relationship between the ViewGroup and its descendants when looking for a View to take focus.Must be one of the following constant values.ConstantValueDescriptionbeforeDescendants0The ViewGroup will get focus before any of its descendants.afterDescendants1Th 阅读全文

posted @ 2012-07-19 10:25 Snowberg 阅读(748) 评论(0) 推荐(0)

android:screenOrientation的说明
摘要:在Android的官方文档当中,对android:screenOrientation的说明如下:android:screenOrientationThe orientation of the activity's display on the device.The value can be any one of the following strings:"unspecified"The default value. The system chooses the orientation. The policy it uses, and therefore the c 阅读全文

posted @ 2012-07-15 20:12 Snowberg 阅读(45627) 评论(0) 推荐(1)

File.mkdir()与File.mkdirs()
摘要:一天半调试时间,一些列的错误仅仅源于使用了mkdir()而没有使用mkdirs()。谨记!客户反馈,程序不能正常更新,于是拿出程序来仔细研究之前的代码,重新审视了 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />像这样的权限代码,没问题,而就是更新不下来。出现进度条一闪而 阅读全文

posted @ 2012-07-13 09:47 Snowberg 阅读(1853) 评论(0) 推荐(0)

android:windowSoftInputMode的说明
摘要:在Android的官方文档当中,对windowSoftInputMode的说明如下:android:windowSoftInputModeHow the main window of the activity interacts with the window containing the on-screen soft keyboard. The setting for this attribute affects two things:The state of the soft keyboard — whether it is hidden or visible — when the act 阅读全文

posted @ 2012-07-10 20:10 Snowberg 阅读(2284) 评论(0) 推荐(0)

Android动态获取资源ID并使用javabean进行赋值
摘要:一、问题 在最近的项目当中遇到这样一个问题,访问网络获取一个企业的详细信息,并显示在客户端,因为信息数量相当多,进一步造成对应的javabean字段非常之多,如果使用javabean.field的方式进行赋值,一方面工作量大,另一方面,非常的容易出错。 这时候就想到使用内省机制,对javabean进行赋值和取值操作,但是,无奈,Android的SDK当中没有引入java的内省机制。于是转战反射。使用反射机制将javabean动态获取javabean当中的字段,并动态获得R.id()的字段,如果这两个字段名相同,就在获得R.id()字段对应的值(Int),然后得到相应的view,并进行赋... 阅读全文

posted @ 2012-05-23 11:25 Snowberg 阅读(1924) 评论(0) 推荐(1)

Android开发当中Parcelable接口的使用
摘要:对于Android来说传递复杂类型,主要是将自己的类转换为基础的字节数组,Activity之间传递数据是通过Intent实现的。Android序列化对象主要有两种方法,实现Serializable接口、或者实现Parcelable接口。实现Serializable接口是Java SE本身就支持的,而Parcelable是Android特有的功能,效率比实现Serializable接口高,而且还可以用在进程间通信(IPC)中。实现Serializable接口非常简单,声明一下就可以了。而实现Parcelable接口稍微复杂一些,但效率更高,推荐用这种方法提高性能。android 中自定义的对象序 阅读全文

posted @ 2012-05-23 09:03 Snowberg 阅读(595) 评论(0) 推荐(0)

getSharedPreferences()与getSharedPreferences(String name, int mode)与getDefaultSharedPreferences
摘要:一直迷惑于这三个方法的关系,最近忙完项目,好好的分析一下。如果你熟悉Context那么你可能知道Context当中有这样一个方法:(关于Context的说明)一、getSharedPreferences(String name, int mode)abstractSharedPreferencesgetSharedPreferences(Stringname, int mode)Retrieve and hold the contents of the preferences file 'name', returning a SharedPreferences through 阅读全文

posted @ 2012-05-22 22:33 Snowberg 阅读(625) 评论(0) 推荐(0)

Android中的Context理解
摘要:1、sdk当中关于Context的介绍Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launchin 阅读全文

posted @ 2012-04-22 21:21 Snowberg 阅读(1705) 评论(0) 推荐(0)

Activity四种加载模式
摘要:在多Activity开发中,有可能是自己应用之间的Activity跳转,或者夹带其他应用的可复用Activity。可能会希望跳转到原来某个Activity实例,而不是产生大量重复的Activity。这需要为Activity配置特定的加载模式,而不是使用默认的加载模式。加载模式分类及在哪里配置Activity有四种加载模式:standardsingleTopsingleTasksingleInstance设置的位置在AndroidManifest.xml文件中activity元素的android:launchMode属性:<activity android:name="ActB& 阅读全文

posted @ 2012-04-21 22:12 Snowberg 阅读(609) 评论(0) 推荐(0)

Android 菜单(OptionMenu)大全 建立你自己的菜单(补充)
摘要:参考:http://www.cnblogs.com/salam/archive/2011/04/04/2005329.html博主,并进行补充。关于OptionsMenu的例子,博主“永恒的记忆”的文章http://www.cnblogs.com/salam/archive/2011/04/04/2005329.html已经讲的非常清楚并且举了非常好的例子,这里只是补充一下关于上下文菜单(ContextMenu)和子菜单(SubMenu)。一、上下文菜单(ContextMenu)关于ContextMenu的详细介绍请参考:http://developer.android.com/referen 阅读全文

posted @ 2012-04-21 16:47 Snowberg 阅读(412) 评论(0) 推荐(0)

关于ListView和Adapter
摘要:未优化的Adapterimport java.util.List; import ouc.sei.proandroid.R; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; public class MyAdapter2 extends BaseAdapter { private List<String> lists; p 阅读全文

posted @ 2012-04-20 21:55 Snowberg 阅读(217) 评论(0) 推荐(0)

发布Android程序
摘要:因为最近经常用到这方面的东西,所以写写来,省的再用的时候一个一个字符的敲,麻烦。一、生成数字证书应用程序使用数字证书签名。数字证书是一个包含相关信息(比如公司名称,地址等信息)的文件。其中一些比较重要的特性如,签名的公/私钥。公/私钥也成为密钥对。这个密钥对可以想CA申请,也可以使用JDK自带的keytool生成,当然自己生成的证书是不被主机所认可的,但是有一点,就是她可以防止你的应用程序被恶意更新。废话少说,先说一下,怎么生成这个证书。生成证书的代码如下:C:\Documents and Settings\Administrator>keytool -genkey -v -keysto 阅读全文

posted @ 2012-04-20 15:03 Snowberg 阅读(474) 评论(0) 推荐(0)

如何反编绎APK文件
摘要:安装ApkTool工具,该工具可以解码得到资源文件,但不能得到Java源文件。安装环境:需要安装JRE1.61> 到http://code.google.com/p/android-apktool/下载apktool1.3.2.tar.bz2 和apktool-install-windows-2.2_r01-3.tar.bz2 文件。解压两个文件,然后把解压后的文件放在一起,如:c:\apktool2> 在系统变量PATH中添加进aapt.exe,如:;c:\apktool\aapt.exe3> 在DOS窗口下进入apktool.jar所在目录。执行DOS命令:apktool 阅读全文

posted @ 2012-04-18 20:13 Snowberg 阅读(409) 评论(0) 推荐(0)

ScrollView嵌套GridView、ListView的解决办法
摘要:问题:在Android开发当中经常会用到了需要ScrollView嵌套GridView或者是ListView的情况,由于这两款控件都自带滚动条,当他们碰到一起的时候便会出问题,即GridView或ListView会显示不全。解决方案:自定义GridView或ListView,去掉其滚动条。一下为GridView的例子。复写GridView:package com.yang.widget; import android.content.Context; import android.util.AttributeSet; import android.widget.GridView; publ.. 阅读全文

posted @ 2012-04-13 10:43 Snowberg 阅读(518) 评论(0) 推荐(0)

如何在Android应用当中避免内存溢出问题
摘要:一、内存溢出现在的智能手机内存已经足够大,但是对于一个应用程序来说智能手机当中稀缺的内存,仍然是应用程序的一大限制。在Android应用程序开发当中,最常见的内存溢出问题(OOM)是在加载图片时出现的,尤其是在不知道图片大小的情况下。潜在的内存溢出操作主要包括以下几点:从网络当中加载用户特定的图片。因为直到我们在下载图片的时候我们才知道图片的大小。向Gallery加载图片。因为现在智能手机的摄像头有很高的分辨率,在加载图片的时候需要最图片进行处理,然后才能正常的使用。请注意一点,Android系统是从系统全局的观念来分配内存以加载图片的,这就意味着,即使你的应用有足够大的内存可用,内存溢出问题 阅读全文

posted @ 2012-04-08 21:45 Snowberg 阅读(847) 评论(0) 推荐(0)

android google map apiKey 相关操作
摘要:来自:http://blog.163.com/fjshqhy_2003/blog/static/140268782011217514938/android 在开发google map 项目的时候,首先需要一个android.keystore文件,该文件在如果是win 7 则:C:\Users\Administrator\.android\如果是win xp 则:C:\Documents and Settings\Administrator\.android\下面,文件一般为:debug.keystore。如果不存在该文件,则需要参加这个文件,创建命令如下:C:\Program Files\Ja 阅读全文

posted @ 2012-04-06 21:40 Snowberg 阅读(522) 评论(0) 推荐(0)

1 2 下一页

导航