鏈結

Anrdoid+CustomCusorAdapter+ListFragment

http://pipicoding.blogspot.hk/2012/04/listview-cursoradapter-viewholder.html

http://wangcuijing.blog.51cto.com/7233352/1275721

http://www.cnblogs.com/skywang12345/p/3160260.html

http://tausiq.wordpress.com/2012/08/22/android-list-view-from-database-with-cursor-adapter/

http://wptrafficanalyzer.in/blog/android-listfragment-with-images-and-text-using-android-support-library/

[Android] Sherlock actionbar & indeterminate progress bar

Here is how you add this kind of indeterminate ProgressBar with aActionBarSherlock object : (actually it’s easier the other one but the progressBar is shown alone and not above a MenuItem)

1 – Put this line in the onCreate() method before the setContentView() call :

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

-> This line specify that you will use the indeterminate ProgressBar function.

2 – Enable the indeterminate ProgressBar by calling :

setSupportProgressBarIndeterminateVisibility(true);

3 – Disable the indeterminate ProgressBar by calling :

setSupportProgressBarIndeterminateVisibility(false);

Remark : Have a look in the sample folder of the ActionBarSherlock folder. I found this code in the following file : JakeWharton-ActionBarSherlock-9598f2b\samples\demos\src\com\actionbarsherlock\sample\demos\IndeterminateProgress.java

http://stackoverflow.com/questions/10905053/how-to-show-indeterminate-progress-bar-when-refresh-button-is-pressed-in-actionb

[Android] volley library with Basic Authentication

I found HttpHeaders and HttpAuthentication Class from

Spring for Android(http://matthias.jimdo.com/2011/07/04/consuming-restful-web-services-on-android-using-spring-android/)

then I follow this ….

http://stackoverflow.com/questions/16817980/how-does-one-use-basic-authentication-with-this-library

to extend the JsonObjectRequest from volley like this…

public class feedJsonObjectRequest extends JsonObjectRequest {

public feedJsonObjectRequest(int method, String url,

JSONObject jsonRequest, Listener<JSONObject> listener,

ErrorListener errorListener) {

super(method, url, jsonRequest, listener, errorListener);

// TODO Auto-generated constructor stub

}

@Override

public Map<String, String> getHeaders() throws AuthFailureError {

// TODO Auto-generated method stub

HttpHeaders requestHeaders = new HttpHeaders();

HttpAuthentication auth = new HttpBasicAuthentication(“username", “password");

requestHeaders.setAuthorization(auth);

return requestHeaders.toSingleValueMap();

}

}

then your can use it just like the normal jsonObjectRequest()….

feedJsonObjectRequest jsObjRequest = new feedJsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {})

[Android] adb is down (Mac OSX)

Sometimes you may get an error as the following….
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
Please ensure that adb is correctly located at “sdk\platform-tools\" and can be executed.

if you are using terminal input : adb start-server….

* daemon not running. starting it now on port 5037 *
cannot bind ‘tcp:5037’
ADB server didn’t ACK

Yes, because port:5037 is occupied by other process

Let’s see who are using it…

lsof -i | grep LISTEN

Close the eclipse FIRST!

last time I had  a “zombile" adb is occupied, then kill it: killall adb

and start new adb
adb kill-server
adb start-server
You will see….

* daemon not running. starting it now on port 5037 *
* daemon started successfully *

and you can see the devices that are connected by….

adb devices

Similar post…

http://www.dotblogs.com.tw/jgame2012/archive/2012/04/06/71311.aspx