0

私はAndroidプログラミングに慣れていないので、リストビューへのリンクを取得することができません。

リンクする私のコードは次のとおりです。

TextView textviewlink = new TextView(this);
textviewlink.setText("text I want to see"); 

TransformFilter mentionFilter = new TransformFilter() { 
public final String transformUrl(final Matcher match, String url) { 
return new String("http://test.com/"); 
} 
}; 

Pattern pattern = Pattern.compile("."); 
String scheme = ""; 
Linkify.addLinks(textviewlink, pattern, scheme, null, mentionFilter); 

Now I want to place textviewlink into a HashMap:

ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>(); 
HashMap<String, String> map = new HashMap<String, String>();

だから私はこのように追加します:

map.put("c1", "STATUTE");
map.put("c0", " ");
map.put("c2", textviewlink.toString()); 
mylist.add(map); 

その後:

ListView listnew = (ListView) findViewById(R.id.lvdata);
SimpleAdapter mSchedulenew = new SimpleAdapter(this, (List<? extends Map<String, ?>>) mylist, R.layout.row, 
new String[] {"c1","c0","c2"}, new int[] {R.id.CELL1,R.id.CELLBlank, R.id.CELL2}); 
listnew.setAdapter(mSchedulenew);   

しかし、それを表示すると、リンクは次のようになります。

android.widget.textview@43e604c0
4

1 に答える 1

0

textviewlink.getText()ではなく使用したいtextviewlink.toString()

toString()オブジェクトの文字列表現を返すだけで、テキスト値とは異なります。

于 2011-06-22T13:58:27.197 に答える