android手机震动权限设置
... Read More
出现 has leaked ServiceConnection android.media.MediaScannerConnecti 类似的系统错误提示
当图片在compress()保存之后,使用gallery去查看的时候,发现刚才保存的图片不存在。
这种情况下,需要使用 MediaScannerConnection 去通知系统扫描到多媒体数据库
Java代码
MediaScannerConnection.MediaScannerConnectionClient client = new MediaScannerConnectionClient(){
//MediaScannerConnection mediaScannerConnection = mConnectionMap.get(MEDIA_CONNECT_KEY);
// ——-千万不要写在这里 初始化顺利的原因 mediaScannerConnection是null 会出现系统错误提示,也不能达到扫描的目的
@Override
public void onMediaScannerConnected() {
MediaScannerConnection mediaScannerConnection = mConnectionMap.get(MEDIA_CONNECT_KEY);
// 注意这里
... Read More
[转载]github常用指令
总结一下ubuntu下github常用的命令,设置部分跳过,假设repository的名字叫hello-world:
1.创建一个新的repository:
先在github上创建并写好相关名字,描述。
$cd ~/hello-world //到hello-world目录
$git init //初始化
$git add . //把所有文件加入到索引(不想把所有文件加入,可以用gitignore或add 具体文件)
$git commit //提交到本地仓库,然后会填写更新日志( -m “更新日志”也可)
$git remote add origin git@github.com:WadeLeng/hello-world.git //增加到remote
$git push origin master //push到github上
2.更新项目(新加了文件):
$cd ~/hello-world
$git add . ... Read More
Android 开发中遇到的问题及解决方法
1.导入含有第三方jar包的项目时,无法定位项目中的jar包,“This will not be added to the package.”
解决方法:
右击项目—>BuildPath–>Configuration Build Path–> 选中右侧的”Libraries“标签–>选中带有红叉的jar包并Remove;
然后单击”Add JARs“,找到该jar包在本项目中的位置就可以了。
如果运行后出现”Could not find .apk“,可以重新导入项目就可以了。
关于Could not find xxx.apk可
参考:http://blog.csdn.net/johee/article/details/5521310
2.“gen already exists but is not a source folder. Convert to a source folder or rename it”
右击项目选”Properties”–>在左侧选中”Java Build Path”–>打开右侧的“Source”标签–>单击”Add... Read More
jQuery Mobile设计Android通讯录(第一章)(2)
jQuery Mobile 页面设计
现在我们来看下如何使用jQuery Mobile框架去设计页面元素。在jQuery... Read More
jQuery Mobile设计Android通讯录(第一章)(1)
本文假设读者已对jQuery Mobile有一定的初步认识,同时也初步了解Android的一些基本用法。
本教程的结构
本系列教程安排如下。在第一部分中,我们将介绍在应用程序中的运行界面截图,说明整个应用的流程走向及结构,并说明一些如何在Android的Webview控件中通过Javascript与后端的JAVA应用程序交互的一些技巧和知识点,其中会介绍jQuery Mobile中的各种重要页面元素。在本系列的第二部分中,将介绍如何在通讯录应用中新增加、编辑和删除帐号。在本系列的第三部分中,将介绍如何增加通讯录,其中会介绍用到一个工具类。在第四部分,将重点介绍如何使用Jackson... Read More
Android界面设计之按钮点击效果
<?xml version=”1.0″ encoding=”UTF-8″?>
<selector xmlns:android=”http://schemas.android.com/apk/res/android”>
<item android:state_pressed=”false” android:drawable=”@drawable/xxx1″ />
<item android:state_pressed=”true” android:drawable=”@drawable/xxx2″ />
<item android:state_focused=”true” android:drawable=”@drawable/xxx3″ /> <– 这里还可以加N多效果和动作 只要你用的到 –> <item android:drawable=”@drawable/xxx4″ />
</selector>
这个文件没有不同,起名为button_add_x.xml... Read More
Android开发窗口实现半透明效果
弹出popwindow的代码如下,比较乱,多包涵:
popupWindow = new PopupWindow(menuView, LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT, true);
popupWindow.showAtLocation(findViewById(R.id.parent), Gravity.CENTER
| Gravity.CENTER, 0, 0);
popupWindow.setAnimationStyle(R.style.PopupAnimation);
// 加上下面两行可以用back键关闭popupwindow,否则必须调用dismiss();
ColorDrawable dw = new ColorDrawable(-00000);
popupWindow.setBackgroundDrawable(dw);
popupWindow.update();
下面是实现步骤:
1.背景置灰:
popupWindow = new PopupWindow(menuView, LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT,... Read More
Android Push Notification Service消息推送
http://www.push-notification.org/
APNS 是什么?
APNS (Android Push Notification Service) 是一种在 android 上轻松实现 push notification 的功能的解决方案. 只需申请一个 API Key, 经过简单的步骤即可实现 push notification 的功能.
特点:
快速集成:提供一种比C2DM更加快捷的使用方式,避免各种限制.
无需架设服务器:通过使用”云服务”,减少额外服务器负担.
通用性强:可以整合各种平台,适用性强,即将推出 html sdk, 使 web app 也可以集成此服务.
耗电少,占用流量少.
获取 API
如何在 Android 应用中使用 Notification ?
a) 在应用中添加 APNS 功能
下载 libaray: com_apns.jar
将com_apns.jar添加到工程在工程上右键打开“属性”,选择... Read More
webview 捕获一些链接的响应
mWebView.setWebViewClient(mWebViewClient);
WebViewClient mWebViewClient = new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//捕获URL点击的事件
if (url.startsWith(“web:getvideoclick;”)) {
//TODO
}
}
public void onPageFinished(WebView view, String url) {
//加载结束... Read More



























