2010-11-19 17 views
1

Sitem için bir bağlantı içeren bir iletişim kutusu oluşturmak istiyorum (android üzerinde) ve kullanıcının bağlantıyı tıkladığında telefonun tarayıcısının açılmasını isterdim. Şu anda var:nasıl textview ve android için

@Override 
protected Dialog onCreateDialog (int id){ 
Dialog dialog = new Dialog(MyActivity.this);             

dialog.setContentView(R.layout.custom_dialog); 
dialog.setTitle("MyTittle"); 
ImageView image = (ImageView)dialog.findViewById(R.id.image); 

image.setImageResource(R.drawable.launcher_icon); 
TextView lblClickable = (TextView)findViewById(R.id.text); 
String htmlText = "Link to my <a HREF='http://www.rainbowbreeze.it'>site</a>"; 
lblClickable.setText(Html.fromHtml(htmlText)); 
//needed to enable click on the link  
lblClickable.setMovementMethod(LinkMovementMethod.getInstance()); 
return dialog; } 

Yukarıdaki kod lblClickable.setText(Html.fromHtml(htmlText)); herhangi bir öneri içeren doğrultusunda NullPointerException ateşler? Kodun nesi var? Ben lblClickable boş olduğunu düşünüyorum

cevap

0

, bu hat muhtemelen yanlıştır:

TextView lblClickable = (TextView)findViewById(R.id.text); 

düzeltilmiş:

TextView lblClickable = (TextView)dialog.findViewById(R.id.text); 
+0

teşekkürler çözüldü çok – maxsap

İlgili konular