摘要:
File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize; //分区大 小 long totalBlocks; //总分区 long 阅读全文
摘要:
public class MD5Encoder { public static String encode(String string) throws Exception { byte[] hash = MessageDigest.getInstance("MD5").digest(string.g 阅读全文
摘要:
阅读全文
摘要:
package com.itheima.zhbj74.utils; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import android.graphics.Bitmap 阅读全文
摘要:
package com.itheima.zhbj74.utils; import android.graphics.Bitmap; import android.support.v4.util.LruCache; /** * 内存缓存 * 因为从 Android 2.3 (API Level 9)开 阅读全文
摘要:
package com.itheima.zhbj74.utils; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.Malformed 阅读全文
摘要:
步骤1.添加custom_progress.xml文件: <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDeg 阅读全文
摘要:
try{ // 1.开启事务 db.beginTransaction(); 事务处理部分... //2.设置事务执行成功,提交时如果这行代码没有执行过,就会回滚 db.setTransactionSuccessful(); // 1.开启事务 db.beginTransaction(); 事务处理部 阅读全文
摘要:
//获取xml序列化器 XmlSerializer xs = Xml.newSerializer(); File file = new File("sdcard/sms2.xml"); FileOutputStream fos; try { fos = new FileOutputStream(fi 阅读全文
摘要:
//发送http请求 try { //1.使用网址构造一个URL对象 URL url = new URL(path); //2.获取连接对象 HttpURLConnection conn = (HttpURLConnection) url.openConnection(); //3.设置一些属性 / 阅读全文
摘要:
Get请求时,请求参数直接拼接在url地址后面。 如:String path = "http://169.254.244.136/Web2/servlet/Login?name=" + URLEncoder.encode(name) + "&pass=" pass; //URLEncoder.enc 阅读全文
摘要:
post请求时,请求参数写入输出流中,url地址除去拼接参数后的地址,如: "http://169.254.244.136/Web2/servlet/Login?name=" + URLEncoder.encode(name) + "&pass=" + pass; 正确地址: String path 阅读全文
摘要:
//1.创建client对象 HttpClient client = new DefaultHttpClient(); //2.创建get请求对象 HttpGet get = new HttpGet(path); //3.使用client发送get请求 HttpResponse response = 阅读全文
摘要:
//1.创建client对象 HttpClient client = new DefaultHttpClient(); //2.创建get请求对象 HttpGet get = new HttpGet(path); //3.使用client发送get请求 HttpResponse response = 阅读全文
摘要:
package com.itheima.multithreaddownload; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStrea 阅读全文
摘要:
第一步,创建一个广播接收者, CallReceiver extends BroadcastReceiver ; 第二步,在AndroidManifest.xml配置文件中注册广播接收者与配置监听电话拨号器发出的广播的Action: <receiver android:name="com.itheim 阅读全文
摘要:
第一步,创建一个广播接收者, SmsReceiver extends BroadcastReceiver ; 第二步,在AndroidManifest.xml配置文件中注册广播接收者与配置监听电话拨号器发出的广播的Action: <receiver android:name="com.itheima 阅读全文
摘要:
第一步,创建一个广播接收者, SDReceiver extends BroadcastReceiver ; 第二步,在AndroidManifest.xml配置文件中注册广播接收者与配置监SD卡状态发生变化时对应的Action: <receiver android:name="com.itheima 阅读全文
摘要:
第一步,创建一个广播接收者, BootReceiver extends BroadcastReceiver 第二步,在AndroidManifest.xml配置文件中注册广播接收者与配置开机启动时对应的Action: <receiver android:name="com.itheima.lesuo 阅读全文
摘要:
在MainActivity中 public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanc 阅读全文