小编use*_*322的帖子

第一次点击时日期选择器不显示

我有一个编辑字段,当我点击它时,日期选择器将打开,但我无法在第一次点击时弹出日期选择器。如果我第一次单击编辑字段,则不会出现日期选择器。当我第二次或第三次单击时,它正在显示。这是我的代码:

public class MainActivity extends Activity implements OnClickListener {

    private Calendar calendar;
    private int day;
    private int month;
    private int year;

    @Override  
    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            setContentView(R.layout.activity);    

            date = (EditText) findViewById(R.id.date);
            calendar = Calendar.getInstance();
            day = calendar.get(Calendar.DAY_OF_MONTH);
            month = calendar.get(Calendar.MONTH);
            year = calendar.get(Calendar.YEAR);
            date.setOnClickListener(this);
    }

    @Override
    protected Dialog onCreateDialog(int id) {
           // TODO Auto-generated method stub
           return new DatePickerDialog(this, datePickerListener, year, month, day);     
    }

    private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {               
        public void onDateSet(DatePicker view, int selectedYear, int …
Run Code Online (Sandbox Code Playgroud)

android datepickerdialog

4
推荐指数
1
解决办法
2538
查看次数

在Android fetch中集成googleplus(性别和生日)

我试图从Android中的googleplus集成获取性别和生日...但是性别为"0"请帮我这个..我附上我的代码..请找下面的代码..生日显示为空...

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mSignInButton = (SignInButton) findViewById(R.id.sign_in_button);

    mSignInButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

              mGoogleApiClient.connect();

        }
    });


    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this).addApi(Plus.API)
            .addScope(Plus.SCOPE_PLUS_PROFILE)
            .addScope(Plus.SCOPE_PLUS_LOGIN).build();
}

protected void onStart() {
    super.onStart();
//  mGoogleApiClient.connect();



}

protected void onStop() {
    super.onStop();

    if (mGoogleApiClient.isConnected()) {
        mGoogleApiClient.disconnect();
    }
}

public void onConnectionFailed(ConnectionResult result) {
    if (!mIntentInProgress && result.hasResolution()) {
        try {
            mIntentInProgress = true;
            startIntentSenderForResult(result.getResolution()
                    .getIntentSender(), RC_SIGN_IN, null, 0, 0, 0);
        } …
Run Code Online (Sandbox Code Playgroud)

java android google-plus

2
推荐指数
1
解决办法
2453
查看次数

标签 统计

android ×2

datepickerdialog ×1

google-plus ×1

java ×1