how to quick exit your app
In android os,there is a way to let you 'exit' your application.
you can new a thread,in the thread cateat Intent to go to homeApp. and then destroy your app in back. note you need use a static object to keep your app state (whether your app has exited the system ). if your app is still runing and you click the app's icon, then you can finish your activity.
how to check your android app memory leak.
In my project,There is a good way.
Just like this.
~/workspace/android-sdk-linux/platform-tools$
------------------------the file-----------------
1 2 3 4 5 6 |
|
Some firefox plugins may use in your project!
1.firebug
2.yslow
3.xmarks
synchronized your bookmarks
4.greasemonkey
5.downThemAll
6.proxyTool
7.stylish
change your firefox page theme,very usefull
8.HttpRequester
simulate http request and catch http response.
9.scrapbook
save your ariginal web page but not DOMTree
Today when i need a customer httpserver,I find sun's httpserver.
It's very easy to do some test.
Below are the simple code.
package com.chenze.android.httpserver;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
public class MyHttpServer {
public MyHttpServer(){
}
public void init() throws IOException{
HttpServer httpServer = HttpServer.create(new InetSocketAddress(8888),0);
httpServer.createContext("/",new MyHttpHandler());
httpServer.setExecutor(null);
httpServer.start();
}
public static void main(String[]args) throws IOException{
MyHttpServer server = new MyHttpServer();
server.init();
}
}
class MyHttpHandler implements HttpHandler{
public void handle(HttpExchange t) throws IOException {
InputStream is = t.getRequestBody();
String response = "<h3>Zilla's HttpServer Start!</h3>";
t.sendResponseHeaders(200, response.length());
OutputStream os = t.getResponseBody();
os.write(response.getBytes());
os.close();
}
}
Not long ago, I developed a java http file upload model.
One things to notice here.
1.the size limited
-----------------------analysis-------------------------
1.Normally,HttpConnection use BufferedStream to buffer in local,When it's buffer is too big,then it will Out Of Memory.
we see across analysing source code that there are two ways to avoid this.
1.1 public void setFixedLengthStreamingMode (int contentLength){}... read more
When we us java Thread,Sometimes we nedd concurrent visit some resources, in this way,we have to use synchronized.
today what we will talk about is wait and notify.
first have a look at this fragment.
public Class A {
public static void main(String[]args) {
ThreadB b = new ThreadB();
b.start();
synchronized(b) {
System.out.println("waiting......");
b.wait();
}
System.out.println("result:"+b.getResult());
}
}... [read more](/p/udtool/blog/2012/06/java-thread-synchronized/)