- 博客(37)
- 资源 (7)
- 收藏
- 关注
原创 Android中android:layout_weight属性解决不同机型平均分布的适配问题
设置android:layout_weight="1"属性:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/ll_guide_home"
2016-10-28 23:09:44 889
原创 Android自带json和Gson数据格式解析示列
DataOfJson dataOfJson = new DataOfJson(getApplicationContext(),url, Request.Method.POST); dataOfJson.setJsonVolleyCallBack(new JsonVolleyCallBack() { @Override public
2016-10-28 09:59:44 989
原创 RecyclerView实现滑动和删除事件的监听方法
调用方法是activity:package com.example.cuboo.mlcircles.view;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import android.support.v7.widget.LinearLayoutManager;import andro
2016-10-27 16:45:01 2392
原创 RecyclerView实现点击和长按事件的监听方法
调用方法的activity:public class RecyclerView_onclick extends AppCompatActivity { private RecyclerView mRecycler_view; private mAdapter_recycler_onclick mAdapter; private RecyclerView.LayoutMa
2016-10-27 16:36:45 1783
原创 Android中Volley的接口回调机制传回数据的示例
步骤1:定义接口类package com.example.cuboo.myapplication.DataFromNetApi;/** * Created by cuboo on 2016/10/27. * 接口回调步骤1:定义监听接口 */public interface VolleyCallBck { public void getStringFromVolley(
2016-10-27 16:22:20 1807
原创 Gson的简单使用
数据类:package com.example.cuboo.myapplication;/** * Created by cuboo on 2016/10/26. */public class weatherinfo { private String city; private String temp; private String time;
2016-10-26 14:09:00 195
转载 自定义Volley的GsonRequest使用
package com.example.cuboo.myapplication;import com.android.volley.NetworkResponse;import com.android.volley.ParseError;import com.android.volley.Request;import com.android.volley.Response;import
2016-10-26 12:17:36 679
原创 Volley中ImageRequest、ImageLoader、NetworkImageView的简单使用
public class VolleyApi{ private Context context; private View view; //步骤1:创建Volley的网络请求队列 RequestQueue mQueue; //定义请求的URL private String url = "http://ditu.amap.com/service/reg
2016-10-26 11:07:48 312
转载 Volley的使用
package com.example.cuboo.myvolley;import android.graphics.Bitmap;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.util.LruCache;import android.widget.Imag
2016-10-26 10:47:44 185
原创 Volley中JsonObjectRequest的使用
package com.example.cuboo.myapplication;import android.content.Context;import android.util.Log;import com.android.volley.AuthFailureError;import com.android.volley.Request;import com.android.vo
2016-10-25 21:35:29 811
原创 Volley中StringRequest的用法
package com.example.cuboo.myapplication;import android.content.Context;import android.util.Log;import com.android.volley.AuthFailureError;import com.android.volley.Request;import com.android.vo
2016-10-25 21:00:38 1049
原创 android中WebView关闭打开第三方浏览器
webView = (WebView) findViewById(R.id.webview); WebSettings wSet = webView.getSettings(); //从ListView中获得URL String url = getIntent().getStringExtra("content_url"); //加载
2016-10-24 11:09:04 1696
原创 Android中ViewPager实现图片的定时轮播效果(设置Integer.MAX_VALUE)
public class Images_home_ad implements ViewPager.OnPageChangeListener { private ViewPager viewPager; private ImageView[] imgs; private ArrayList arrayList; private PagerAdapter adapter
2016-10-22 19:08:13 728
原创 Android设置圆形组件以及在组件中设置图标或文字的2中方法
方法1:利用CardView实现<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/my_card_view" android:layout_gravity="center"
2016-10-20 21:18:37 1063
原创 Java字符串String、StringBuffer、StringBuilder区别
String 字符串内容不可以改变,赋值为创建一个新对象的堆内存空间地址。StringBuffer 可以改变字符串内容(不创建新的堆内存),使用时需要实例化对象。类的对象能够被多次的修改,并且不产生新的未使用对象,在线程安全的情况下,则必须使用StringBuffer类。StringBuilder是StringBuffer 的一个简单的替换,和StringBuffer之间的最大不同在于
2016-10-16 11:41:48 386
原创 Java中数字签名RSASignature 算法的使用
import java.security.*;import java.security.interfaces.RSAPrivateKey;import java.security.interfaces.RSAPublicKey;import java.security.spec.PKCS8EncodedKeySpec;import java.util.HashMap;import jav
2016-10-15 21:41:14 13419 1
原创 Java读取与写入图片文件
// FileImageInputStream fis = new FileImageInputStream(new File("timg.jpg"));// FileImageOutputStream fos = new FileImageOutputStream(new File("timg1.jpg")); FileInputStream fi
2016-10-15 20:08:20 23564
原创 Java非对称加密算法RSA
主方法类:import javafx.scene.effect.DisplacementMap;import java.security.interfaces.RSAPrivateKey;import java.security.interfaces.RSAPublicKey;import java.util.HashMap;import java.util.Map;/** *
2016-10-15 19:04:30 298
原创 Java非对称加密(DH算法)
方法类:import javax.crypto.KeyAgreement;import javax.crypto.SecretKey;import javax.crypto.interfaces.DHPrivateKey;import javax.crypto.interfaces.DHPublicKey;import javax.crypto.spec.DHParameterSpec
2016-10-15 17:13:48 455
原创 Java中Base64加密和解密
import sun.misc.BASE64Decoder;import sun.misc.BASE64Encoder;import java.io.IOException;/** * Created by cuboo on 2016/10/15. */public class Base64code { public static String encryptBase64(
2016-10-15 14:05:01 960
原创 Java十六进制字符串转byte和字符转字节
//十六进制字符串转字节数组 public static byte[] fromHexStringToBytes(String hexString) { if ((hexString == null) || (hexString.equals("")) || hexString.length()%2 != 0){ return null;
2016-10-15 13:25:43 678
原创 Java中消息摘要的编程(MD5/SHA/HMAC)的使用
主类:/** * Created by cuboo on 2016/10/14. */public class Main { public static void main(String agrs[]) throws Exception { //String keyType = "MD5"; // String keyType = "SHA-1"/S
2016-10-14 22:05:38 221
原创 Java中十六进制字符串转为原字符串(26英文字母)
public static String fromHexStringToString(String str){ char[] c = str.toCharArray(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < c.length-1; i+=2) {
2016-10-14 21:50:40 1756
原创 java对称加密(DES/DESESE/AES)的简单使用
主类:/** * Created by cuboo on 2016/10/14. */public class Main { public static void main(String agrs[]) throws Exception { //String keyType = "DES"; DES的使用 //int keysize = 56;
2016-10-14 19:45:34 1364
原创 Java中byte[]数组转十六进制String(利用Integer)
public static String bytesToHexString(byte[] data){ StringBuilder strb = new StringBuilder(); for (int i = 0; i < data.length; i++) { strb.append(Integer.toHexString(data[
2016-10-14 16:33:37 285
原创 设计模式之Java自定义观察者模式
观察者接口:/** * Created by cuboo on 2016/10/14. */public interface Observer { public void update(Observable o,T agr);}观察者具体实现类:/** * Created by cuboo on 2016/10/14. */public class concr
2016-10-14 13:30:55 438
原创 设计模式之Java中的单例模式
import java.util.Scanner;/** * Created by cuboo on 2016/10/13. */public class test { public static void main(String agrs[]){ singleMode s = singleMode.getInstance();//获得一个实例
2016-10-13 20:29:09 187
原创 Java中统计字符出现个数和单词出现个数(Map解决)
import java.util.*;/** * Created by cuboo on 2016/10/13. */public class test { private static Scanner scanner; public static void main(String agrs[]){ count_word(); } /
2016-10-13 17:17:28 8316
原创 Java字符串和单词的反转
import java.util.Iterator;import java.util.LinkedList;import java.util.List;import java.util.Scanner;/** * Created by cuboo on 2016/10/13. */public class test { private static Scanner scan
2016-10-13 14:45:52 5328
原创 Java中UDP的简单使用
服务端:/** * Created by cuboo on 2016/10/12. */import java.io.IOException;import java.net.DatagramPacket;import java.net.DatagramSocket;import java.net.InetAddress;import java.net.SocketExceptio
2016-10-12 21:57:46 1649
原创 Java中TCP的简单使用
服务器端:import java.io.*;import java.net.InetAddress;import java.net.ServerSocket;import java.net.Socket;import java.net.UnknownHostException;/** * Created by cuboo on 2016/10/12. */public cla
2016-10-12 17:27:17 345
原创 Java中线程同步
/** * Created by cuboo on 2016/10/3. */public class threaddemo{ public static void main(String agrs[]){ thread r = new thread(); Thread t = new Thread(r,"A"); Thread t1
2016-10-12 13:44:50 178
原创 Java反射中Annotation的
定义Annotation的构造方法的类:import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;/** * Created b
2016-10-11 20:47:10 249
原创 Java反射的使用
主类:import java.lang.reflect.Constructor;import java.lang.reflect.Field;import java.lang.reflect.Method;/** * Created by cuboo on 2016/10/11. */public class Main01 { public static void mai
2016-10-11 18:53:58 221
原创 Java的RandomAccessFile随机文件读写的简单使用
import java.io.*;/** * Created by cuboo on 2016/10/10. */public class io { public static void main(String agrs[]){ //写入数据 File file = new File("test.txt"); if (!file.e
2016-10-10 19:55:16 1385
原创 Java的FileReader与FileWriter
FileReader与FileWriter直接操作文件数据流,并包装为缓冲流进行文件拷贝。import java.io.*;/** * Created by cuboo on 2016/10/10. */public class io { public static void main(String agrs[]){ try { File
2016-10-10 18:40:56 252
学习写个简单的用户管理系统
2018-09-01
实现淘宝购物车RecyclerView或LIstView的嵌套选择的逻辑的源码
2016-12-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人