android - OnClick crashes my application -


I have a text view in the dialog and I think that when I click to do this text view something.
I want to do this when clicking on something to textview

I have clickable and click onClick in my layout. Here are my codes

  Public class activity increases two action activity {@ Override public zero On Crate (Bundle Saved Instantstate) {Super. Contents (Saved Instantstate); // working code // working code // working code // working code} // to show this a dialog // it does a good job! Public Zero Share (View View) {sharedialog = New Dialogue (Activity Two.); Sharedialog.requestWindowFeature (Window.FEATURE_NO_TITLE); Sharedialog.setContentView (R.layout.postdialog); Sharedialog.setCanceledOnTouchOutside (true); Shareialog.getWindow (). Setbackground driveable (new color depth (android.graphics.color.TRANSPARENT)); Sharedialog.show (); } Public void facebookp (views) A // for {// TextView (onClick) it does not work ..}}  

This is my layout (postdialog.xml )

  & lt; Relative layout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: ads = "http://schemas.android.com/ apk / Race-auto" android: id = "@ + id / postdialogl "Android: Layout_width =" Match_parent "Android: layout_marginLeft =" 20dp "Android: layout_marginRight =" 20dp "Android: layout_height =" 150dp "android: background =" @ drawable / Postdiylog "& gt; & Lt; Android: layout_height = "wrap_content" android: layout_marginTop = "10dp" Android: layout_marginLeft = "20dp" Android: textSize = "18sp" Android: TextStyle: TextView Android: id = "@ + id / postdtitle" Android: layout_width = "wrap_content" = "Bold" android: text = "@ string / post" Android: textColor = "# a7b8d6" /> & Lt; imageView android: id = "@ + id / poststrokea" Android: layout_width = "match_parent" Android: layout_height = "0.5dp" android: background = "# 202e4c" Android: layout_below = "@ + id / postdtitle" Android: layout_marginTop = "5dp" /> & Lt; imageView android: id = "@ + id / poststrokeb" Android: layout_width = "match_parent" Android: layout_height = "0.5dp" android: background = "# 803e5482" Android: layout_below = "@ + id / poststrokea" / & gt; & Lt; Android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: gravity = "center" android: layout_marginop = "60dp" Android: layout_marginLeft = "30dp" android: drawablePadding: Android: layout_height = "wrap_content" android: id = "@ + id / facebookpost" = "5dp" android: text = "@ string / Facebook" Android: textcolor = "# a7b8d6" Android: TextSize = "L2sp" Android: drawableTop = "@ drawable / Facebook" android: clickable = "true" Android: OnClick = "facebookp" /> & Lt; / RelativeLayout & gt;  

One solution is to declare your dialog in your dialog.

  Public Zero share (View View) {// Your Code Partnership = New Dialogue (Activity Two.); Sharedialog.requestWindowFeature (Window.FEATURE_NO_TITLE); Sharedialog.setContentView (R.layout.postdialog); Sharedialog.setCanceledOnTouchOutside (true); . Sharedialog.getWindow () setBackgroundDrawable (newColorDrawable (android.graphics.Color.TRANSPARENT)); Last text view tviPost = (TextView) sharedialog.findViewById (R.id.sharedialog); TviPost.setOnClickListener (New OnClickListener) {Click Public Zero (see ARG0) {// do something}}); Sharedialog.show (); }  

and delete the next lines from your layout.

  android: clickable = "true" android: onClick = "facebookp"  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -