私はこれをlibraryと一緒に使っています。私はSpinnerの国の電話番号で国リストを持っています。国を選択するときには、国コードをEditTextフィールドに表示する必要があります。これは私のコードです:EditTextを使ったぼかしスピナー
CountryCodePicker ccp;
String countryCode;
EditText phoneNumberEditText;
ccp = (CountryCodePicker) findViewById(R.id.country_cod_picker);
final CountryCodePicker ccp = new CountryCodePicker(this);
phoneNumberEditText = (EditText) findViewById(R.id.phone_number_edit_text);
countryCode = ccp.getSelectedCountryCode();
ccp.setOnCountryChangeListener(new CountryCodePicker.OnCountryChangeListener() {
@Override
public void onCountrySelected() {
phoneNumberEditText.setText(countryCode);
}
});
私のアプリはクラッシュしませんが、コントリーコードは表示されません。お願い助けて!ありがとうございました。
私はそれをやった - 今私のアプリケーションがクラッシュします。私はjava.lang.NullPointerExceptionとjava.lang.RuntimeExceptionを持っています – bogach4312