2012-02-24 7 views
0

R.layout.news_01storyで宣言された2つのTextViewに文字列tと文字列bの値を割り当てたい これを行うことはできますか?必要なヘルプ!AndroidプログラミングのTextViewsへの文字列値の割り当て?

怒鳴る方法は、我々はリストビュー内の項目をクリックすると、新しいレイアウトに私たちを取る - >

@Override 
public void onListItemClick(ListView parent, View v, int position, long id) { 
    CustomAdapter adapter = (CustomAdapter) parent.getAdapter(); 
     RowData row = adapter.getItem(position); 
     String t = row.mTitle; 
     String b = row.mDescription; 

     AlertDialog.Builder builder=new AlertDialog.Builder(this); 
     LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); 
     View layout = inflater.inflate(R.layout.news_01story,null); 
     builder.setView(layout); 
     builder.show(); 
} 

よろしく!

答えて

0
.... 
View layout = inflater.inflate(R.layout.news_01story,null); 
TextView textView1 = (TextView)layout.findViewById(R.id....); 
textView.setText(t); 
TextView textView2 = (TextView)layout.findViewById(R.id....); 
textView.setText(b); 
.... 
+0

これはマイナーチェンジで動作します...助けてくれてありがとう! –

0

だけ

((TextView)layout.findViewById(R.id.text_view_1)).setText(t); 
((TextView)layout.findViewById(R.id.text_view_2)).setText(b); 
+0

GR8を使用!助けてくれてありがとう –

+0

http://meta.stackexchange.com/a/5235/176901 – Jin35

関連する問題