答えて

1
 both = (RadioButton) findViewById(R.id.both); 

    RadioGroup radioGroup = (RadioGroup) findViewById(R.id.rgroup); 
    assert radioGroup != null; 
     radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() 
    { 
     public void onCheckedChanged(RadioGroup group, int checkedId) { 

      if (veg.isChecked()) { 
       proof="veg"; 
       //Toast.makeText(getApplicationContext(),proof,Toast.LENGTH_SHORT).show(); 
      } else if(nonv.isChecked()) { 
       proof="non veg"; 
        //Toast.makeText(getApplicationContext(),proof,Toast.LENGTH_SHORT).show(); 
      } 
      else if (both.isChecked()){ 
       AlertDialog.Builder builder = new AlertDialog.Builder(this); 
     builder.setTitle("GPS is off"); // GPS not found 
     builder.setMessage("Turn on location services"); // Want to enable? 
     builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { 
      public void onClick(DialogInterface dialogInterface, int i) { 

       ConnectToWifi.this.startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS)); 

      } 
     }); 
     builder.setNegativeButton("No", null); 
     builder.create().show(); 

      } 

     } 
    }); 
関連する問題