use of android.widget.ArrayAdapter in project ViewPagerTransforms by ToxicBakery.
the class MainActivity method onCreate.
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int selectedPage = 0;
if (savedInstanceState != null) {
mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS);
selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE);
}
final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>(getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1, TRANSFORM_CLASSES);
setContentView(R.layout.activity_main);
mAdapter = new PageAdapter(getFragmentManager());
mPager = (ViewPager) findViewById(R.id.container);
mPager.setAdapter(mAdapter);
mPager.setCurrentItem(selectedPage);
final ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setListNavigationCallbacks(actionBarAdapter, this);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
//noinspection ResourceType
actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setSelectedNavigationItem(mSelectedItem);
}
}
use of android.widget.ArrayAdapter in project android_frameworks_base by ParanoidAndroid.
the class FrameworkPerfActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set the layout for this activity. You can find it
// in res/layout/hello_activity.xml
setContentView(R.layout.main);
mFgSpinner = (Spinner) findViewById(R.id.fgspinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAvailOpLabels);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mFgSpinner.setAdapter(adapter);
mFgSpinner.setOnItemSelectedListener(this);
mBgSpinner = (Spinner) findViewById(R.id.bgspinner);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAvailOpLabels);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mBgSpinner.setAdapter(adapter);
mBgSpinner.setOnItemSelectedListener(this);
mLimitSpinner = (Spinner) findViewById(R.id.limitspinner);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mLimitLabels);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mLimitSpinner.setAdapter(adapter);
mLimitSpinner.setOnItemSelectedListener(this);
mTestTime = (TextView) findViewById(R.id.testtime);
mLimitLabel = (TextView) findViewById(R.id.limitlabel);
mStartButton = (Button) findViewById(R.id.start);
mStartButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startRunning();
}
});
mStopButton = (Button) findViewById(R.id.stop);
mStopButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stopRunning();
}
});
mStopButton.setEnabled(false);
mLocalCheckBox = (CheckBox) findViewById(R.id.local);
mLog = (TextView) findViewById(R.id.log);
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Scheduler");
mPartialWakeLock.setReferenceCounted(false);
}
use of android.widget.ArrayAdapter in project android_frameworks_base by ParanoidAndroid.
the class ScoAudioTest method onCreate.
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.scoaudiotest);
mScoStateTxt = (TextView) findViewById(R.id.scoStateTxt);
mVdStateTxt = (TextView) findViewById(R.id.vdStateTxt);
IntentFilter intentFilter = new IntentFilter(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
intentFilter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED);
intentFilter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
registerReceiver(mReceiver, intentFilter);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mAudioManager2 = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
mHandler = new Handler();
mMediaControllers[0] = new SimplePlayerController(this, R.id.playPause1, R.id.stop1, R.raw.sine440_mo_16b_16k, AudioManager.STREAM_BLUETOOTH_SCO);
TextView name = (TextView) findViewById(R.id.playPause1Text);
name.setText("VOICE_CALL stream");
mScoButton = (ToggleButton) findViewById(R.id.ForceScoButton);
mScoButton.setOnCheckedChangeListener(mForceScoChanged);
mForceScoOn = false;
mScoButton.setChecked(mForceScoOn);
mVoiceDialerButton = (ToggleButton) findViewById(R.id.VoiceDialerButton);
mVoiceDialerButton.setOnCheckedChangeListener(mVoiceDialerChanged);
mVoiceDialerOn = false;
mVoiceDialerButton.setChecked(mVoiceDialerOn);
mMediaControllers[1] = new SimpleRecordController(this, R.id.recStop1, 0, "Sco_record_");
mTtsInited = false;
mTts = new TextToSpeech(this, new TtsInitListener());
mTtsParams = new HashMap<String, String>();
mTtsParams.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_BLUETOOTH_SCO));
mTtsParams.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, UTTERANCE);
mSpeakText = (EditText) findViewById(R.id.speakTextEdit);
mSpeakText.setOnKeyListener(mSpeakKeyListener);
mSpeakText.setText("sco audio test sentence");
mTtsToFileButton = (ToggleButton) findViewById(R.id.TtsToFileButton);
mTtsToFileButton.setOnCheckedChangeListener(mTtsToFileChanged);
mTtsToFile = true;
mTtsToFileButton.setChecked(mTtsToFile);
mModeSpinner = (Spinner) findViewById(R.id.modeSpinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mModeStrings);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mModeSpinner.setAdapter(adapter);
mModeSpinner.setOnItemSelectedListener(mModeChanged);
mCurrentMode = mAudioManager.getMode();
mModeSpinner.setSelection(mCurrentMode);
mBluetoothHeadsetDevice = null;
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
if (btAdapter != null) {
btAdapter.getProfileProxy(this, mBluetoothProfileServiceListener, BluetoothProfile.HEADSET);
}
sVoiceCommandIntent = new Intent(Intent.ACTION_VOICE_COMMAND);
sVoiceCommandIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
use of android.widget.ArrayAdapter in project android-app-common-tasks by multidots.
the class CodeSnippestHomeActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = CodeSnippestHomeActivity.this;
//Activity mActivity = CodeSnippestHomeActivity.this;
String[] sdkFunctionalityListValue = new String[] { "Executing a HTTP Get Request", /* 0 */
"Executing a HTTP Post Request", /* 1 */
"Executing a HTTP post Request for Send Audio,Video and Image" };
ListView sdkFunctionalityList = (ListView) findViewById(R.id.Md_list_company);
ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, sdkFunctionalityListValue);
sdkFunctionalityList.setAdapter(stringArrayAdapter);
sdkFunctionalityList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
selectedListItem(position);
}
});
}
use of android.widget.ArrayAdapter in project KeepScore by nolanlawson.
the class DialogHelper method showPlayerNameDialog.
public static void showPlayerNameDialog(final Context context, final int titleResId, final String startingValue, final int newPlayerNumber, final Callback<String> onResult) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final AutoCompleteTextView editText = (AutoCompleteTextView) inflater.inflate(R.layout.change_player_name, null, false);
editText.setHint(context.getString(R.string.text_player) + " " + (newPlayerNumber + 1));
editText.setText(StringUtil.nullToEmpty(startingValue));
new AlertDialog.Builder(context).setTitle(titleResId).setView(editText).setCancelable(true).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String newName = StringUtil.nullToEmpty(editText.getText().toString());
onResult.onCallback(newName);
dialog.dismiss();
}
}).setNegativeButton(android.R.string.cancel, null).show();
// fetch suggestions in the background to avoid jankiness
new AsyncTask<Void, Void, List<String>>() {
@Override
protected List<String> doInBackground(Void... params) {
return PlayerNameHelper.getPlayerNameSuggestions(context);
}
@Override
protected void onPostExecute(List<String> result) {
super.onPostExecute(result);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, R.layout.simple_dropdown_small, result);
editText.setAdapter(adapter);
}
}.execute((Void) null);
}
Aggregations