##ListView読み込み
- 件数指定
- 自動・手動
- 追加ボタン・オーバースクロール
- リストアイテム非同期読み込みとか
##AsyncTask
- 結果のコールバック
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:id="@android:id/background"> | |
<shape android:shape="line"> | |
<stroke | |
android:width="4dp" | |
android:color="#474747" | |
/> |
package secret | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.webkit.WebView; |
// in android :p | |
private void printFib(int l) { | |
fib(l).subscribe(new Action1<List<Long>>() { | |
@Override | |
public void call(List<Long> fib) { | |
Log.v(TAG, fib.toString()); | |
} | |
}); | |
} |
package net.nessness.android.sample.listview; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import android.app.ListActivity; | |
import android.os.Bundle; | |
import android.widget.ListView; | |
import android.widget.SimpleAdapter; | |
public class ListViewSampleActivity extends ListActivity { |
<?xml version="1.0" encoding="utf-8"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:state_pressed="true"> | |
<layer-list> | |
<item android:drawable="@drawable/btn_back"/> | |
<item android:drawable="@drawable/list_pressed_holo_light"/> | |
</layer-list></item> | |
<item android:drawable="@drawable/btn_back"></item> |
text = client.execute(httpGet, new ResponseHandler<String>() { | |
@Override | |
public String handleResponse(HttpResponse resp) | |
throws ClientProtocolException, IOException { | |
if (resp.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { | |
throw new IOException(resp.getStatusLine().getStatusCode() + "returned."); | |
} | |
HttpEntity entity = resp.getEntity(); | |
if (entity != null) { | |
InputStream is = entity.getContent(); |
527 /** | |
528 * Set the descendant focusability of this view group. This defines the relationship | |
529 * between this view group and its descendants when looking for a view to | |
530 * take focus in {@link #requestFocus(int, android.graphics.Rect)}. | |
531 * | |
532 * @param focusability one of {@link #FOCUS_BEFORE_DESCENDANTS}, {@link #FOCUS_AFTER_DESCENDANTS}, | |
533 * {@link #FOCUS_BLOCK_DESCENDANTS}. | |
534 */ | |
535 public void setDescendantFocusability(int focusability) { | |
536 switch (focusability) { |
FragmentStatePagerで持ってるfragmentはめくっていくとonStopが呼ばれるのでここでよしなにするとよい(かも |
##ListView読み込み
##AsyncTask
public static Twitter getTwitter(Context ctx) { | |
InputStream is = null; | |
TwitterFactory tf; | |
try { | |
is = ctx.getResources().getAssets().open("twitter4j.properties"); | |
PropertyConfiguration conf = new PropertyConfiguration(is); | |
tf = new TwitterFactory(conf); | |
} catch (IOException e) { | |
tf = new TwitterFactory(); |