【Google】Androidアプリ作成part9
■ このスレッドは過去ログ倉庫に格納されています
0145デフォルトの名無しさん
2011/07/23(土) 16:16:02.85こんな感じかな。自分ではこういうやり方してるわけじゃないからお勧めはしない。
public<T extends View> T findGenericViewById(int id){
return (T) findViewById(id);
}
TextView tv = findGenericViewById(id);
public<T extends View> T
findGenericViewById(int id,Class<T> c){
return (T) findViewById(id);
}
findGenericViewById(id,TextView.class).setText("foo");
■ このスレッドは過去ログ倉庫に格納されています