use of android.widget.RadioGroup in project J2ME-Loader by nikita36078.
the class ChoiceGroup method getItemContentView.
@Override
public View getItemContentView() {
Context context = getOwnerForm().getParentActivity();
switch(choiceType) {
case EXCLUSIVE:
if (buttongroup == null) {
buttongroup = new RadioGroup(context);
initButtonGroup();
((RadioGroup) buttongroup).setOnCheckedChangeListener(radiolistener);
}
return buttongroup;
case MULTIPLE:
if (buttongroup == null) {
buttongroup = new LinearLayout(context);
initButtonGroup();
}
return buttongroup;
case POPUP:
if (spinner == null) {
adapter = new CompoundSpinnerAdapter(context);
spinner = new Spinner(context);
spinner.setAdapter(adapter);
int size = selected.size();
for (int i = 0; i < size; i++) {
adapter.append(strings.get(i), images.get(i));
}
if (selectedIndex >= 0 && selectedIndex < selected.size()) {
spinner.setSelection(selectedIndex);
}
spinner.setOnItemSelectedListener(spinlistener);
}
return spinner;
default:
throw new InternalError();
}
}
use of android.widget.RadioGroup in project httpclient by pixmob.
the class CustomNavigation method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// Used for theme switching in samples
setTheme(SampleList.THEME);
super.onCreate(savedInstanceState);
setContentView(R.layout.text);
((TextView) findViewById(R.id.text)).setText(R.string.custom_navigation_content);
// Inflate the custom view
View customNav = LayoutInflater.from(this).inflate(R.layout.custom_view, null);
// Bind to its state change
((RadioGroup) customNav.findViewById(R.id.radio_nav)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
Toast.makeText(CustomNavigation.this, "Navigation selection changed.", Toast.LENGTH_SHORT).show();
}
});
// Attach to the action bar
getSupportActionBar().setCustomView(customNav);
getSupportActionBar().setDisplayShowCustomEnabled(true);
}
use of android.widget.RadioGroup in project cloudrail-si-android-sdk by CloudRail.
the class MainActivity method onClick.
@Override
public void onClick(View view) {
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup);
final Email service;
switch(radioGroup.getCheckedRadioButtonId()) {
case R.id.mailJetRadioButton:
{
service = mailJet;
break;
}
case R.id.sendGridRadioButton:
{
service = sendGrid;
break;
}
default:
throw new RuntimeException("Unknown Button ID!!");
}
final String fromAdr = ((EditText) findViewById(R.id.senderEditText)).getText().toString().trim();
final String fromName = fromAdr;
String toAdresses = ((EditText) findViewById(R.id.receiverEditText)).getText().toString();
final List<String> toAdressesList = Arrays.asList(toAdresses.split(","));
for (String s : toAdressesList) {
s = s.trim();
}
final String subject = ((EditText) findViewById(R.id.subjectEditText)).getText().toString().trim();
final String textBody = ((EditText) findViewById(R.id.messageEditText)).getText().toString().trim();
final String htmlBody = textBody;
final List<String> ccAdresses = null;
final List<String> bccAdresses = null;
String serviceStr = "mailJet";
if (service == sendGrid)
serviceStr = "sendGrid";
System.out.println("from: " + fromAdr + " to: " + toAdresses + " with" + serviceStr + " subject: " + subject);
new Thread(new Runnable() {
@Override
public void run() {
service.sendEmail(fromAdr, fromName, toAdressesList, subject, textBody, htmlBody, ccAdresses, bccAdresses);
}
}).start();
}
use of android.widget.RadioGroup in project platform_frameworks_base by android.
the class HugeBackupActivity method populateUI.
/**
* Configure the UI based on our persistent data, creating the
* data file and establishing defaults if necessary.
*/
void populateUI() {
RandomAccessFile file;
// Default values in case there's no data file yet
int whichFilling = R.id.pastrami;
boolean addMayo = false;
boolean addTomato = false;
/** Hold the data-access lock around access to the file */
synchronized (HugeBackupActivity.sDataLock) {
boolean exists = mDataFile.exists();
try {
file = new RandomAccessFile(mDataFile, "rw");
if (exists) {
Log.v(TAG, "datafile exists");
whichFilling = file.readInt();
addMayo = file.readBoolean();
addTomato = file.readBoolean();
Log.v(TAG, " mayo=" + addMayo + " tomato=" + addTomato + " filling=" + whichFilling);
} else {
// The default values were configured above: write them
// to the newly-created file.
Log.v(TAG, "creating default datafile");
writeDataToFileLocked(file, addMayo, addTomato, whichFilling);
// We also need to perform an initial backup; ask for one
mBackupManager.dataChanged();
}
} catch (IOException ioe) {
}
}
/** Now that we've processed the file, build the UI outside the lock */
mFillingGroup.check(whichFilling);
mAddMayoCheckbox.setChecked(addMayo);
mAddTomatoCheckbox.setChecked(addTomato);
/**
* We also want to record the new state when the user makes changes,
* so install simple observers that do this
*/
mFillingGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
// As with the checkbox listeners, rewrite the
// entire state file
Log.v(TAG, "New radio item selected: " + checkedId);
recordNewUIState();
}
});
CompoundButton.OnCheckedChangeListener checkListener = new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// Whichever one is altered, we rewrite the entire UI state
Log.v(TAG, "Checkbox toggled: " + buttonView);
recordNewUIState();
}
};
mAddMayoCheckbox.setOnCheckedChangeListener(checkListener);
mAddTomatoCheckbox.setOnCheckedChangeListener(checkListener);
}
use of android.widget.RadioGroup in project platform_frameworks_base by android.
the class NotificationBuilderTest method getRadioTag.
private String getRadioTag(int id) {
final RadioGroup g = (RadioGroup) findViewById(id);
final View v = findViewById(g.getCheckedRadioButtonId());
return (String) v.getTag();
}
Aggregations