04 2016 档案
摘要:MenuLeftFragment MenuRightFragment MainActivity
阅读全文
摘要:xml: <com.handmark.pulltorefresh.library.PullToRefreshGridView android:id="@+id/gridView" android:layout_width="match_parent" android:layout_height="m
阅读全文
摘要:1.广播接收者 广播接收者简单地说就是接收广播意图的Java类,此Java类继承BroadcastReceiver类,重写: public void onReceive(Context context,Intent intent),其中intent可以获得传递的数据; 广播意图就是通过Context
阅读全文
摘要:MainActivity.java bt.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String e
阅读全文
摘要:百度地图 异步任务 public class MyAsynctask extends AsyncTask<String, Integer, String> { //定义变量 HttpURLConnection connection; protected String doInBackground(S
阅读全文
摘要:mainactivity.java final String key = et.getText().toString(); new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method
阅读全文
摘要:item.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_p
阅读全文
摘要:anim popupwindow_anim <set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="500" android:fromYDelta="100%p" a
阅读全文
摘要:1.内容提供者查找手机SD卡下的音乐 配置读取SD卡权限 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> package com.bawei.day07_music; import java.uti
阅读全文
摘要:先把List<>改为ArrayList<>
阅读全文
摘要:checkbox点击切换背景 <CheckBox android:id="@+id/checkbox" android:layout_width="40dp" android:layout_height="40dp" android:button="@null" android:focusable=
阅读全文
摘要:首先来明确一个问题,那就是在某些情况下,有些对象,我们只需要一个就可以了,比如,一台计算机上可以连好几个打印机,但是这个计算机上的打印程序只能有一个,这里就可以通过单例模式来避免两个打印作业同时输出到打印机中,即在整个的打印过程中我只有一个打印程序的实例。 简单说来,单例模式(也叫单件模式)的作用就
阅读全文
摘要:<selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="false" android:drawable="@drawable/btstart"></item
阅读全文
摘要:只需要重新onSaveInstanceState方法,在其里面记住我们要记录的参数 package com.bawei.day07_videoview; import android.os.Bundle;import android.os.Environment;import android.app
阅读全文
摘要:xml <com.example.scrollviewlistview.MyScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/to
阅读全文
摘要:activity_main.xml <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width=
阅读全文
摘要:在这里我要提出的是,listview能滚动的前提是:当listview本身的高度小于listview里的子view。 第一种方法(简单) 只需在MainActivity中 找到listview 和 scrollview 然后给listview设置监听事件 listview.setOnTouchLis
阅读全文
摘要:第一种方法: 在计算listview总高度并设置 使用该方法需要注意:子ListView的每个Item必须是LinearLayout,不能是其他的,因为其他的Layout(如RelativeLayout)没有重写onMeasure(),所以会在onMeasure()时抛出异常。 <LinearLay
阅读全文
摘要:activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:la
阅读全文
摘要:listveiw.xml 如果ListView的Item中包含CheckBox,由于CheckBox的焦点优先级高于ListView,所以当选中ListView时,ListView将不会有选中的状态,解决的方法就是在checkbox组件中加一属性:android:focusable="false"
阅读全文
摘要:package com.ch.day5_httpclient; import java.util.List; import com.ch.myutils.NetWorkUtil;import com.google.gson.Gson;import com.google.gson.reflect.Ty
阅读全文
摘要:package com.ch.day4_httpurlconn; import java.io.BufferedReader;import java.io.DataOutputStream;import java.io.IOException;import java.io.InputStreamRe
阅读全文
摘要:增:insert into 表名 (字段名,字段名) values (?,?,?)删:delete from 表名 where 字段=?改:update 表名 set 字段=?,字段=? where 条件=?查:select * form 表名 where 字段=?(*可以更改为想要查找的内容) 创
阅读全文
摘要:package com.ch.day8_asynctaskdemo; import java.util.ArrayList; import com.ch.myutils.NetWorkUtil; import android.os.AsyncTask;import android.os.Bundle
阅读全文
摘要:package com.bawei.day14_xmlpull; import java.io.IOException;import java.io.InputStream;import java.util.ArrayList;import java.util.List; import org.xm
阅读全文
摘要:package com.example.day5_xutildemo; import java.util.ArrayList;import java.util.List; import com.baidu.vo.Car;import com.lidroid.xutils.DbUtils;import
阅读全文
摘要:package com.bawei.xml; import java.io.IOException;import java.io.InputStream;import java.util.ArrayList;import java.util.List; import org.apache.http.
阅读全文
摘要:<html> <head> <title>myHtml.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="thi
阅读全文
摘要:先导universal-image-loader-1.9.3包 在application配置 android:name=".MyApplication" intent权限 package com.ch.day13_imageloaderdemo; import java.io.File; impor
阅读全文
摘要:Layout_Xml activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
阅读全文
摘要:导包import com.google.gson.reflect.TypeToken; //获取数据 String st=NetWork.geturl(URL); //解析数据 Gson gson=new Gson(); //typetoken解析数组 Type type=new TypeToken
阅读全文
摘要:XMl <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="ma
阅读全文
摘要:在xml文件下创建图片imageview在res下创建文件夹选Tween animation类型文件夹名称anim以下文件透明动画 <?xml version="1.0" encoding="utf-8"?><alpha xmlns:android="http://schemas.android.c
阅读全文
摘要:package com.example.day11_actionbardemo; import android.os.Bundle;import android.app.ActionBar;import android.app.ActionBar.OnNavigationListener;impor
阅读全文
摘要://着色String str = my_info.getTitle();//得到总共的数据title//得到搜索关键字的开始索引if(name != null){//要改变的字体int indexOf = str.indexOf(name);//开始长度if(indexOf != -1){int e
阅读全文
摘要:package com.bawei.lian2; import java.util.ArrayList;import java.util.HashSet;import java.util.List;import java.util.Set; import com.bawei.vo.Good;impo
阅读全文
摘要:// 对话框 AlertDialog.Builder builder = new Builder(MainActivity.this); builder.setMessage("是否确认删除!") .setPositiveButton("确认", new DialogInterface.OnClic
阅读全文
摘要:import java.io.Serializable;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map; import android.os.Bundle;i
阅读全文
摘要:配置权限 <uses-permission android:name="android.permission.BLUETOOTH"/><uses-permission android:name="android.permission.INTERNET"/><uses-permission andro
阅读全文
摘要:扫描文件及文件夹 package com.bwie.demo; import java.io.File;import java.io.FileFilter;import java.util.ArrayList;import java.util.List; public class Demo { pr
阅读全文
摘要:1、要使用Android系统中的电话拨号功能,首先必须在AndroidManifest.xml功能清单中加入允许拨打电话的权限: <uses-permission android:name="android.permission.CALL_PHONE" /> // 允许拨打电话权限 2、进行拨打电话
阅读全文
摘要:背景知识:当Android启动时,会发出一个系统广播,内容为ACTION_BOOT_COMPLETED,它的字符串常量表示为 android.intent.action.BOOT_COMPLETED。只要在程序中“捕捉”到这个消息,再启动之即可。记住,Android框架说:Don''t call m
阅读全文
摘要:package com.bawei.d4; import java.util.ArrayList;import java.util.List; import android.os.Bundle;import android.app.Activity;import android.content.In
阅读全文
摘要:内页面 不单写页面 viewpager+布局 import java.util.ArrayList;import java.util.List; import android.os.Bundle;import android.app.Activity;import android.graphics.
阅读全文
摘要:import android.app.Activity;import android.content.Intent;import android.content.SharedPreferences;import android.content.SharedPreferences.Editor;imp
阅读全文
摘要:sharedPreferences = getSharedPreferences("zhuce", 0);if(!sharedPreferences.getBoolean("text",false)){sharedPreferences.edit().putBoolean("text",true).
阅读全文
摘要:很多APP都有侧滑菜单的功能,部分APP左右都是侧滑菜单~SlidingMenu 这个开源项目可以很好帮助我们实现侧滑功能,如果对SlidingMenu 还不是很了解的童鞋,可以参考下本篇博客。 本片博客只是SlidingMenu的简单用法适合新手使用,谢谢支持。 首先得先导个第三方包:slidin
阅读全文
摘要:Fiddler是一个http调试代理,它能 够记录所有的你电脑和互联网之间的http通讯,Fiddler 可以也可以让你检查所有的http通讯,设置断点,以及Fiddle 所有的“进出”的数据(指cookie,html,js,css等文件,这些都可以让你胡乱修改的意思)。 Fiddler 要比其他的
阅读全文
摘要://直接在方法中打 Calendar c = Calendar.getInstance(); // 获取当前年份 String mYear = String.valueOf(c.get(Calendar.YEAR)); // 获取当前月份 String mMonth = String.valueOf
阅读全文
摘要:接着Android第三方登录详解1讲 1.找到友盟 文档中心 2.找到 3.将 这句话放到对应activity 弄成全局即可 4QQ 登录 5将上述代码放到activity里 oncreate(Bundle savedInstanceState){}里 导包 6找到AndroidManifest.x
阅读全文
摘要:HttpUtils httpUtils = new HttpUtils(); //网址 RequestParams params = new RequestParams(); params.addBodyParameter("type", "1");// 必填 params.addBodyParam
阅读全文
摘要:现在android项目values下打 attrs.xml style.xml <?xml version="1.0" encoding="utf-8"?><resources> <!-- 默认风格 --> <style name="BrowserThemeDefault" parent="@and
阅读全文
摘要:package com.ch.services; import com.ch.utils.NetWorkUtils; import android.app.Service;import android.content.Intent;import android.os.IBinder;import a
阅读全文
摘要:Android中Notification通知的实现步骤: 1.获取NotificationManager对象NotificationManager的三个公共方法:①cancel(int id) 取消以前显示的一个通知.假如是一个短暂的通知,试图将隐藏,假如是一个持久的通知,将从状态条中移走。②can
阅读全文
摘要:xiazai_checkbox.xml <?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_s
阅读全文
摘要:在百度上 搜索百度云推送http://push.baidu.com/ 文档中心有个 3分钟快速入门 http://push.baidu.com/doc/guide/join 点击下载SDK 立即下载 点击创建应用 (注意包名) 创建完成 点击应用配置 有API KEY值 剩下看文档中心http://
阅读全文
摘要:1 获取友盟Appkey 2 下载并安装SDK 3 添加资源文件和jar文件 4 Manifest配置,添加友盟Appkey/Activity/权限 (上面是一些准备 具体可查看之前写的Android第三方登录详解1,2) 5 打开平台选择面板 5.1 首先在您的Activity中添加如下成员变量并
阅读全文
摘要:/Hor/res/layout/activity_main.xml 布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/
阅读全文
摘要:values下修改strings添加 直接粘 <?xml version="1.0" encoding="utf-8"?><resources> <string name="app_name">XListView刷新</string> <string name="hello_world">Hello
阅读全文
摘要:Mainactivity.XML <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layou
阅读全文
摘要:方法: 1.1.1 通过BaseAdapter的getViewTypeCount()获取Item种类数量,然后在getView()方法中根据不同的type设置不同的item布局 (操作麻烦,维护方便) 1.1.2 根据需求设置布局的显示隐藏效果 (操作方便,维护麻烦 ) 下面展示第一种 主页面布局
阅读全文
摘要:各个组件位置: 导xutils包gson包配置网络权限 values包下面 strings修改 <?xml version="1.0" encoding="utf-8"?><resources> <string name="app_name">Pull</string> <string name="
阅读全文
摘要:Java 程序在解析 HTML 文档时,相信大家都接触过 htmlparser 这个开源项目,我曾经在 IBM DW 上发表过两篇关于 htmlparser 的文章,分别是:从 HTML 中攫取你所需的信息和 扩展 HTMLParser 对自定义标签的处理能力。但现在我已经不再使用 htmlpars
阅读全文
摘要:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_
阅读全文
摘要:<oschina> <catalog>1</catalog> <newsCount>0</newsCount> <pagesize>20</pagesize> <newslist> <news> <id>72168</id> <title> <
浙公网安备 33010602011771号