- 博客(24)
- 收藏
- 关注
原创 idea lombok get/set 错误解决
网络上很很多勾选Enable annotation processing但是没有用我最终解决是添加POM如下,并且刷新maven,完美解决<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.0</version> </dependency>...
2020-09-04 10:51:47
612
原创 java简单爬虫
URL getUrl =new URL("http://www.weather.com.cn/data/sk/101230201.html"); //创建URl连接 HttpURLConnection connection = (HttpURLConnection) getUrl.openConnection(); //建立连接 connection.connect...
2019-09-18 00:39:36
165
原创 Ajax异步请求,
前端<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+requ...
2019-09-06 12:35:52
186
原创 swing聊天室
服务器端//服务器中不停的接收客户端的链接多线程类public class Server implements Runnable{private ServerSocket server;private boolean isRunnable=false;private BackInterface back;ServerClientSocket socket;public Serv...
2019-08-30 11:12:56
374
原创 重定向与转发
pageContext.setAttribute("page", "page");//1request.setAttribute("requset", "requset");//2session.setAttribute("session", "session");//3application.setAttribute("application", "application");//4...
2019-08-30 10:58:04
131
原创 输入输出流
public static void main(String[] args) { // TODO Auto-generated method stub File file=new File("a.txt"); if (!file.exists()) { boolean flag; try { flag = file.createNewFile();//创建 ...
2019-08-12 17:21:27
269
原创 sql
-- select 字段 from 表名-- 查询全部select * from t_user-- 查询部分字段select u_name,gender from t_user-- as重命名关键字 注意:其实as是可以省略的select u_name as 姓名,gender as 性别 from t_userselect u_name 姓名,gender 性别 from...
2019-08-02 16:04:56
172
原创 链接数据库
public static void main(String[] args) { // TODO Auto-generated method stub Connection con=null;//链接对象 Statement sta=null;//语句对象(写sql) try { //1.加载并注册 Class.forName("com.mysql.jd...
2019-08-02 16:04:48
194
翻译 集合set list HashMap Collection与Collections
Collections是Collection的工具类集合遍历的方法map.entrySet();2次封装HashMap进Set;
2019-07-27 15:16:01
172
翻译 集合LinkedList
ArrayList类的常用方法LinkedList迭代器Iterator<String> iterator=list.iterator(); while(iterator.hasNext()){ System.out.print(iterator.next()+" "); }
2019-07-27 15:02:31
113
原创 Calendar 设置某年某月的日历
package day5;import java.util.Calendar;import java.util.Scanner;public class date { public static void main(String[] args) { System.out.println("输入年"); String weet[]={"星期7","星期1","星期2...
2019-07-26 13:03:41
6120
原创 SwipeRefreshLayout下拉刷新的简单实现
layout布局<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:to...
2019-06-29 14:50:51
211
原创 DrawerLayout抽屉动画
布局文件<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools=...
2019-06-29 14:15:55
282
原创 Fragment 的实现与使用
布局文件<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_heigh...
2019-06-29 14:02:49
170
原创 Handler是一种异步回调机 网络显示图片
Handler是一种异步回调机制,主要负责与子线程进行通信。– Handler机制主要包括四个关键对象:• Message:消息,它由MessageQueue统一列队,由Handler处理。• Handler:处理者,主要负责Message的发送以及处理。• MessageQueue:消息队列,主要用来存放Handler发送过来的消息, 并且按照先入先出的规则执行。• Looper:消息...
2019-06-28 20:24:09
198
原创 内容的观察者
text1 中PersonDBOpenHelper页面 创建数据public class PersonDBOpenHelper extends SQLiteOpenHelper { //构造方法,调用此方法新建一个person.db的数据库并返回一个数据库帮助类的对象 public PersonDBOpenHelper(Context context) { su...
2019-06-28 18:14:21
188
原创 内容解析者ContentResolver,显示短信
信息封装类SmsInfopublic class SmsInfo { private int _id; // 短信的主键 private String address; // 发送地址 private int type; // 类型 private String body;...
2019-06-28 16:18:50
519
原创 startService与bindService开启服务的生命周期的区别
1、startService方式开启服务的生命周期服务会执行onCreate() 和onStartCommand()方法,服务处于运行状态, 直到自身调用stopSelf()方法或者其他组件调用stopService()方法时服务停止, 最终被系统销毁。服务会长期的在后台运行,并且服务的状态与开启者的状态没有关系。public class MainActivity extends AppCo...
2019-06-25 23:51:42
1749
原创 开机自启应用
创建AutoReceiver继承于BroadcastReceiverpublic class AutoReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent i=new Intent(context,MainAc...
2019-06-25 18:31:44
270
原创 ListView与RecycleView的代码实现
一.RecycleView:RecycleAdapter适配器public class RecycleAdapter extends RecyclerView.Adapter<RecycleAdapter.AppViewHolder> { private ArrayList<App>apps; public RecycleAdapter(ArrayLi...
2019-06-25 14:38:56
183
原创 SQLlite数据库的增删改查
MyHelper页窜见数据库和方法public class MyHelper extends SQLiteOpenHelper { public MyHelper(Context context) { super(context, "itcast.db", null, 1); } @Override public void onCreate(SQL...
2019-06-25 13:03:46
640
原创 存取值与 SharedPreferences存值得区别
一.Filesaveqq页面public class Filesaveqq { //保存用户信息 public static boolean saveUserinfo(Context context ,String name,String poss){ try { FileOutputStream fos= context.openFileOu...
2019-06-25 00:31:22
239
原创 json解析
weather2.json页面[ {"id":"sh","temp":"20/30","name":"上海"}, {"id":"xm","temp":"10/100","name":"厦门"}, {"id":"fz","temp":"5/10","name":"福州"}]weatherService 页面 对json数据进行解析并返回public class weatherS...
2019-06-24 23:11:01
139
原创 XML解析的初步学习
XML解析的初步学习weatherService页面,解析Xml<infos> <city id="sh"> <name>上海</name> <temp>20/30</temp> </city> <city id="xm"> &...
2019-06-24 22:28:43
130
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅