java.lang.NullPointerException at android.widget.AutoCompleteTextView $ PassThroughClickListener.access $ 302 at android.widget.AutoCompleteTextView.setOnClickListener at android.view.View. at android.widget.TextView. at android.widget.EditText. at android.widget.AutoCompleteTextView. at android.widget.AutoCompleteTextView. at java.lang.reflect.Constructor.newInstance at android.view.LayoutInflater.createView at android.view.LayoutInflater.onCreateView at android.view.LayoutInflater.createViewFromTag at android.view.LayoutInflater.rInflate_Original at android.view.LayoutInflater_Delegate.rInflate at android.view.LayoutInflater.rInflate at android.view.LayoutInflater.rInflate_Original at android.view.LayoutInflater_Delegate.rInflate at android.view.LayoutInflater.rInflate at android.view.LayoutInflater.rInflate_Original at android.view.LayoutInflater_Delegate.rInflate at android.view.LayoutInflater.rInflate at android.view.LayoutInflater.inflate at android.view.LayoutInflater.inflate
Function corresponding java page
public void setSex (View view) { final EditText txtsex = (EditText) this.findViewById (R.id.txtsex); String [] strSex = getResources () getStringArray (R.array.sex);. AlertDialog.Builder builder; builder = new AlertDialog.Builder (this); builder.setTitle ("sex selection"); builder.setCancelable (false); builder.setSingleChoiceItems (strSex, 0, new DialogInterface.OnClickListener () {
@ Override public void onClick (DialogInterface dialog, int which) { / / TODO Auto-generated method stub index = which; } }); builder.setPositiveButton (R.string.confirm, new DialogInterface.OnClickListener () {
@ Override public void onClick (DialogInterface dialog, int which) { / / TODO Auto-generated method stub txtsex.setText (getResources () getStringArray (R.array.sex) [index].); } }); builder.setNegativeButton (R.string.cancel, new DialogInterface.OnClickListener () {
@ Override public void onClick (DialogInterface dialog, int which) { / / TODO Auto-generated method stub txtsex.setText (""); } }); builder.create () show ();. }
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply: xml defined android: onClick will report this error, the code will not be registered, is a bit strange. Your registration code in it. Reply: Where do? Please enlighten me! Reply: The android: onClick = "setSex" remove the onCreate method in activity rearmost plus
((AutoCompleteTextView) findViewById (R.id.txtsex)) setOnClickListener (new OnClickListener () {.
Yo West, I try Reply: Seemingly defined in xml android: onClick only for the Button class (including subclasses), otherwise an error, the best landlord is registered onClick event in code, 3rd Floor, positive solution! Reply:
button and other controls or a little different, I had to add Button in GridView in each sub-View, click the event turned out to be useful for wood Reply: Well, it. Another question, do you have used Android-studio, why compiled program which characters will be garbled ah Reply:
Never used, I have been using eclipse Reply:
xml defined android: onClick will report this error, the code will not be registered, is a bit strange. Your registration code in it.
Well, it. Another question, do you have used Android-studio, why compiled program which characters will be garbled ah
Never used, I have been using eclipse
ah! ! ! Well, finally, all in English, not to force ah (although the finished package, but I do not have to exercise their own). . . . . . . . . . . . . . . . . . . . . Recommend you use this software, Google themselves than Eclipse smooth Reply:
xml defined android: onClick will report this error, the code will not be registered, is a bit strange. Your registration code in it.
Well, it. Another question, do you have used Android-studio, why compiled program which characters will be garbled ah
Never used, Google introduced the IDE did not take long, according to some feedback and some bug, need to be improved. I am from eclipse to Intellij IDEA, I feel stronger than Eclipse, easy to use and more, stdio Based on this, and the idea to support Chinese encoding, and it's smart tips, integrated version control is very powerful, it is recommended to use the landlord!
No comments:
Post a Comment