This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 复制数据库 | |
try { | |
String destPath = "/data/data/" + getPackageName() + "/databases/jixiezhishi.db"; | |
CopyDB( getBaseContext().getAssets().open("jixiezhishi.db"), | |
new FileOutputStream(destPath)); | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread thread = new Thread(new Runnable() { | |
@Override | |
public void run() { | |
try { | |
HttpClient hc = new DefaultHttpClient(); | |
HttpGet hg = new HttpGet("http://www.baidu.com"); | |
HttpResponse hr = hc.execute(hg); | |
int code = hr.getStatusLine().getStatusCode(); | |
InputStream is = hr.getEntity().getContent(); | |
InputStreamReader isr = new InputStreamReader(is); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.http.HttpResponse; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
try { | |
HttpClient hc = new DefaultHttpClient(); | |
HttpGet hg = new HttpGet("http://www.baidu.com"); | |
HttpResponse hr = hc.execute(hg); | |
int code = hr.getStatusLine().getStatusCode(); | |
InputStream is=hr.getEntity().getContent(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name":"wang", | |
"sex":"male", | |
"age":21 | |
} | |
String str1 = "{\n" + | |
"\"name\":\"wang\",\n" + | |
"\"sex\":\"male\",\n" + | |
"\"age\":21\n" + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String str1="abbb234234abbbbbb"; | |
System.out.println(str1.replaceAll("ab*", "k")); //贪婪模式 | |
//k234234k | |
System.out.println(str1.replaceAll("ab*?", "k")); //非贪婪模式 | |
//kbbb234234kbbbbbb | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hexiaochun; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import javax.servlet.ServletException; |
OlderNewer