Java Code Examples for android.widget.ArrayAdapter

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: TextViewActivity.java

  18 
vote

private void init(){
  final String[] strings=new String[]{"abc","abd","abe","bcd","bce","bcf"};
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,strings);
  textView=(TextView)findViewById(R.id.my_textview);
  editText=(EditText)findViewById(R.id.my_edittext);
  autoCompleteTextView=(AutoCompleteTextView)findViewById(R.id.my_autocompletetextview);
  checkedTextView=(CheckedTextView)findViewById(R.id.my_checkedtextview);
  multiAutoCompleteTextView=(MultiAutoCompleteTextView)findViewById(R.id.my_multiautocompletetextview);
  checkedTextView.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      checkedTextView.toggle();
      if (checkedTextView.isChecked()) {
        checkedTextView.setText("Checked");
      }
 else {
        checkedTextView.setText("Unchecked");
      }
    }
  }
);
  autoCompleteTextView.setAdapter(adapter);
  multiAutoCompleteTextView.setAdapter(adapter);
  multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
 

Example 2

From project android-client, under directory /xwiki-android-components/src/org/xwiki/android/components/search/.

Source file: SearchActivity.java

  17 
vote

private void loadWikiList(){
  Wikis ws=request.requestWikis();
  wikiList=new String[ws.getWikis().size()];
  for (int i=0; i < wikiList.length; i++) {
    wikiList[i]=ws.getWikis().get(i).getName();
  }
  Spinner spinner=(Spinner)findViewById(R.id.spinner_wikilist);
  ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_spinner_item,wikiList);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int pos,    long id){
      wikiName=parent.getItemAtPosition(pos).toString();
      loadSpaceList(wikiName);
    }
    public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
}
 

Example 3

From project android-joedayz, under directory /Proyectos/Socrates/src/org/upc/socrates/nota/.

Source file: BusqCursosActivity.java

  17 
vote

/** 
 * Called when the activity is first created. 
 */
@SuppressWarnings("rawtypes") @Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  theme.onActivityCreateSetTheme(this);
  setContentView(R.layout.busq_cursos);
  modalidadSpinner=(Spinner)findViewById(R.id.modalidadSpinner);
  ArrayAdapter adapter=ArrayAdapter.createFromResource(this,R.array.modalidades,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  modalidadSpinner.setAdapter(adapter);
  cicloSpinner=(Spinner)findViewById(R.id.cicloSpinner);
  adapter=ArrayAdapter.createFromResource(this,R.array.ciclos,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  cicloSpinner.setAdapter(adapter);
  siguienteButton=(Button)findViewById(R.id.siguienteButton);
  siguienteButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View view){
      Intent intent=new Intent(BusqCursosActivity.this,CursosListActivity.class);
      startActivity(intent);
    }
  }
);
}
 

Example 4

From project cw-advandroid, under directory /SystemServices/Settings/src/com/commonsware/android/syssvc/settings/.

Source file: SettingsSetter.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
  setListAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_multiple_choice,settings));
  ContentResolver cr=getContentResolver();
  for (int i=0; i < settings.size(); i++) {
    BooleanSetting s=settings.get(i);
    getListView().setItemChecked(i,s.isChecked(cr));
  }
}
 

Example 5

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: ExploreActivity.java

  16 
vote

/** 
 * {@inheritDoc}
 */
@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.a_list);
  super.initTitleBarViews();
  mList=(ListView)findViewById(android.R.id.list);
  mValues=getResources().getStringArray(R.array.exploreListValues);
  mAdapter=new ArrayAdapter<String>(getApplicationContext(),R.layout.simple_list_item,R.id.listItemText,mValues);
  mList.setAdapter(mAdapter);
  mList.setOnItemClickListener(this);
  setTitleBarTitle(R.string.titleBarExplore);
  setSessionCodeVisibility(true);
  GCMRegistrar.checkManifest(this);
  final String regId=GCMRegistrar.getRegistrationId(this);
  if (regId.equals("")) {
    GCMRegistrar.register(this,"273557760831");
  }
 else {
    Mobeelizer.registerForRemoteNotifications(regId);
  }
}
 

Example 6

From project 2Degrees-Toolbox, under directory /Toolbox/src/biz/shadowservices/DegreesToolbox/Preferences/.

Source file: WidgetListActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  List<WidgetInstance> widgets=new ArrayList<WidgetInstance>();
  for (  AbstractWidgetUpdater updater : Values.widgetUpdaters) {
    widgets.addAll(updater.getWidgets(this));
  }
  arrayAdapter=new ArrayAdapter<WidgetInstance>(this,R.layout.list_item,widgets);
  setListAdapter(arrayAdapter);
  ListView lv=getListView();
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      WidgetInstance widget=arrayAdapter.getItem(position);
      Intent openWidgetPreferences=new Intent(view.getContext(),WidgetPreferencesActivity.class);
      openWidgetPreferences.putExtra("widget",widget);
      startActivity(openWidgetPreferences);
    }
  }
);
}
 

Example 7

From project 4308Cirrus, under directory /tendril-example/src/main/java/edu/colorado/cs/cirrus/android/.

Source file: DevicesActivity.java

  15 
vote

@Override public void onStart(){
  super.onStart();
  Devices devices=null;
  try {
    this.showLoadingProgressDialog();
    devices=tendril.fetchDevices();
    ListView devicesList=(ListView)findViewById(R.id.devicesList);
    List<String> deviceNameList=new ArrayList<String>();
    for (    Device d : devices.getDevice()) {
      deviceNameList.add(d.getName());
    }
    ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,deviceNameList);
    devicesList.setAdapter(adapter);
    devicesList.setOnItemClickListener(new OnItemClickListener(){
      public void onItemClick(      AdapterView<?> parent,      View view,      int position,      long id){
        Intent deviceDetailIntent=new Intent(DevicesActivity.this,DeviceDetailActivity.class);
        deviceDetailIntent.putExtra("deviceID",position);
        startActivity(deviceDetailIntent);
      }
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
    Toast.makeText(getApplicationContext(),e.getLocalizedMessage(),Toast.LENGTH_LONG).show();
  }
 finally {
    this.dismissProgressDialog();
  }
}
 

Example 8

From project ActionBarSherlock, under directory /samples/demos/src/com/actionbarsherlock/sample/demos/.

Source file: ListNavigation.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  setTheme(SampleList.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.list_navigation);
  mSelected=(TextView)findViewById(R.id.text);
  mLocations=getResources().getStringArray(R.array.locations);
  Context context=getSupportActionBar().getThemedContext();
  ArrayAdapter<CharSequence> list=ArrayAdapter.createFromResource(context,R.array.locations,R.layout.sherlock_spinner_item);
  list.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
  getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  getSupportActionBar().setListNavigationCallbacks(list,this);
}
 

Example 9

From project alljoyn_java, under directory /samples/android/chat/src/org/alljoyn/bus/sample/chat/.

Source file: DialogBuilder.java

  15 
vote

public Dialog createUseJoinDialog(final Activity activity,final ChatApplication application){
  Log.i(TAG,"createUseJoinDialog()");
  final Dialog dialog=new Dialog(activity);
  dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.usejoindialog);
  ArrayAdapter<String> channelListAdapter=new ArrayAdapter<String>(activity,android.R.layout.test_list_item);
  final ListView channelList=(ListView)dialog.findViewById(R.id.useJoinChannelList);
  channelList.setAdapter(channelListAdapter);
  List<String> channels=application.getFoundChannels();
  for (  String channel : channels) {
    int lastDot=channel.lastIndexOf('.');
    if (lastDot < 0) {
      continue;
    }
    channelListAdapter.add(channel.substring(lastDot + 1));
  }
  channelListAdapter.notifyDataSetChanged();
  channelList.setOnItemClickListener(new ListView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      String name=channelList.getItemAtPosition(position).toString();
      application.useSetChannelName(name);
      application.useJoinChannel();
      activity.removeDialog(UseActivity.DIALOG_JOIN_ID);
    }
  }
);
  Button cancel=(Button)dialog.findViewById(R.id.useJoinCancel);
  cancel.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      activity.removeDialog(UseActivity.DIALOG_JOIN_ID);
    }
  }
);
  return dialog;
}
 

Example 10

From project Amantech, under directory /Android/CloudAppStudioAndroid/src/com/cloudappstudio/activities/.

Source file: LoginActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(com.cloudappstudio.android.R.layout.login_view);
  accounts=getGoogleAccounts();
  ListView accountList=(ListView)findViewById(R.id.accountListView);
  accountList.setAdapter(new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_list_item_1,accountsToString(accounts)));
  accountList.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    final int pos,    long id){
      new LoginAuthTask().execute(pos);
    }
  }
);
}
 

Example 11

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/base/.

Source file: DocumentSelectionBase.java

  15 
vote

private void initialiseView(){
  languageList=new ArrayList<Language>();
  displayedDocuments=new ArrayList<Book>();
  ArrayAdapter<Book> listArrayAdapter=new DocumentItemAdapter(this,LIST_ITEM_TYPE,displayedDocuments,isInstallStatusIconsShown);
  setListAdapter(listArrayAdapter);
  documentTypeSpinner=(Spinner)findViewById(R.id.documentTypeSpinner);
  setInitialDocumentType();
  documentTypeSpinner.setSelection(selectedDocumentFilterNo);
  documentTypeSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      selectedDocumentFilterNo=position;
      DocumentSelectionBase.this.filterDocuments();
    }
    @Override public void onNothingSelected(    AdapterView<?> arg0){
    }
  }
);
{
    langSpinner=(Spinner)findViewById(R.id.languageSpinner);
    langSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
      @Override public void onItemSelected(      AdapterView<?> parent,      View view,      int position,      long id){
        selectedLanguageNo=position;
        lastSelectedLanguage=languageList.get(selectedLanguageNo);
        DocumentSelectionBase.this.filterDocuments();
      }
      @Override public void onNothingSelected(      AdapterView<?> arg0){
      }
    }
);
    langArrayAdapter=new ArrayAdapter<Language>(this,android.R.layout.simple_spinner_item,languageList);
    langArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    langSpinner.setAdapter(langArrayAdapter);
  }
}
 

Example 12

From project Android, under directory /KnightsFootball/src/.

Source file: TeamFragment.java

  15 
vote

@Override public void onActivityCreated(Bundle savedState){
  super.onActivityCreated(savedState);
  final View detailsFrame=getActivity().findViewById(R.id.fragment_details);
  mDualPane=detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;
  final String[] array={getString(R.string.schedules),getString(R.string.staff)};
  final ArrayAdapter<CharSequence> adapter=new ArrayAdapter<CharSequence>(getActivity(),android.R.layout.simple_list_item_1,array);
  setListAdapter(adapter);
}
 

Example 13

From project android-donations-lib, under directory /org_donations/src/org/donations/.

Source file: DonationsActivity.java

  15 
vote

/** 
 * Called when the activity is first created.
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.donations__activity);
  if (DonationsUtils.getResourceBoolean(this,"donations__flattr_enabled")) {
    ViewStub flattrViewStub=(ViewStub)findViewById(R.id.donations__flattr_stub);
    flattrViewStub.inflate();
    buildFlattrView();
  }
  mGoogleEnabled=DonationsUtils.getResourceBoolean(this,"donations__google_enabled");
  if (mGoogleEnabled) {
    ViewStub googleViewStub=(ViewStub)findViewById(R.id.donations__google_stub);
    googleViewStub.inflate();
    CATALOG=DonationsUtils.getResourceStringArray(this,"donations__google_catalog");
    mGoogleSpinner=(Spinner)findViewById(R.id.donations__google_android_market_spinner);
    ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.donations__google_android_market_promt_array,android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mGoogleSpinner.setAdapter(adapter);
    mHandler=new Handler();
    mDonatePurchaseObserver=new DonatePurchaseObserver(mHandler);
    mBillingService=new BillingService();
    mBillingService.setContext(this);
  }
  if (DonationsUtils.getResourceBoolean(this,"donations__paypal_enabled")) {
    ViewStub paypalViewStub=(ViewStub)findViewById(R.id.donations__paypal_stub);
    paypalViewStub.inflate();
  }
}
 

Example 14

From project android-flash-cards, under directory /src/org/thomasamsler/android/flashcards/fragment/.

Source file: ActionbarFragment.java

  15 
vote

private ArrayAdapter<String> getArrayAdapter(){
  return new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,mOverflowActions){
    @Override public View getView(    int position,    View convertView,    ViewGroup parent){
      View view=super.getView(position,convertView,parent);
      ((TextView)view).setTextColor(Color.WHITE);
      return view;
    }
  }
;
}
 

Example 15

From project Android-Flashcards, under directory /src/com/secretsockssoftware/androidflashcards/.

Source file: DownloadableLessonList.java

  15 
vote

@Override public void handleMessage(Message msg){
  pd.dismiss();
switch (msg.what) {
case 0:
{
      availLessons=(ArrayList<AvailLesson>)(msg.obj);
      setListAdapter(new ArrayAdapter<AvailLesson>(me,android.R.layout.simple_list_item_1,availLessons));
      getListView().setTextFilterEnabled(true);
      return;
    }
case 1:
{
    AlertDialog alertDialog=new AlertDialog.Builder(me).create();
    alertDialog.setTitle("Error");
    alertDialog.setMessage("Sorry, but an error occured trying to download the list of available lessons:\n" + msg.obj);
    alertDialog.setButton(DialogInterface.BUTTON_POSITIVE,"OK",new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        finish();
        return;
      }
    }
);
    alertDialog.show();
  }
}
}
 

Example 16

From project android-pulltorefresh, under directory /pulltorefreshexample/src/com/markupartist/android/example/pulltorefresh/.

Source file: PullToRefreshActivity.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.pull_to_refresh);
  ((PullToRefreshListView)getListView()).setOnRefreshListener(new OnRefreshListener(){
    @Override public void onRefresh(){
      new GetDataTask().execute();
    }
  }
);
  mListItems=new LinkedList<String>();
  mListItems.addAll(Arrays.asList(mStrings));
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,mListItems);
  setListAdapter(adapter);
}
 

Example 17

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: AccessControlActivity.java

  15 
vote

private void displayLoadingCell(){
  String a[]=new String[1];
  a[0]="Loading...";
  setListAdapter(new ArrayAdapter<String>(this,R.layout.loadingcell,R.id.loading_label,a));
  getListView().setTextFilterEnabled(true);
  getListView().setDividerHeight(0);
  getListView().setItemsCanFocus(false);
}
 

Example 18

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/core/activity/.

Source file: HelpActivity.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.help);
  ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.help_screens,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mHelpSpinner.setAdapter(adapter);
  mHelpSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onNothingSelected(    AdapterView<?> arg0){
    }
    public void onItemSelected(    AdapterView<?> parent,    View v,    int position,    long id){
      int resId=HelpActivity.this.getResources().getIdentifier("help" + position,cStringType,cPackage);
      mHelpContent.setText(HelpActivity.this.getText(resId));
      updateNavigationButtons();
    }
  }
);
  mPrevious.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      int position=mHelpSpinner.getSelectedItemPosition();
      mHelpSpinner.setSelection(position - 1);
    }
  }
);
  mNext.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      int position=mHelpSpinner.getSelectedItemPosition();
      mHelpSpinner.setSelection(position + 1);
    }
  }
);
  setSelectionFromBundle(getIntent().getExtras());
}
 

Example 19

From project Android-SQL-Helper, under directory /tests/AndroidSampleProject/src/com/sgxmobileapps/androidsqlhelper/example/.

Source file: UserProfileListActivity.java

  15 
vote

@Override protected void onResume(){
  super.onResume();
  mDbAdapter.open();
  AppUserProfile[] profiles=mDbAdapter.getAllAppUserProfile();
  ArrayAdapter<AppUserProfile> adapter=new ArrayAdapter<AppUserProfile>(this,R.layout.userprofile_list_elem,R.id.textview,profiles);
  setListAdapter(adapter);
}
 

Example 20

From project android-viewflow, under directory /viewflow-example/src/org/taptwo/android/widget/viewflow/example/.

Source file: DiffViewFlowExample.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle(R.string.diff_title);
  setContentView(R.layout.title_layout);
  viewFlow=(ViewFlow)findViewById(R.id.viewflow);
  DiffAdapter adapter=new DiffAdapter(this);
  viewFlow.setAdapter(adapter);
  TitleFlowIndicator indicator=(TitleFlowIndicator)findViewById(R.id.viewflowindic);
  indicator.setTitleProvider(adapter);
  viewFlow.setFlowIndicator(indicator);
  listView=(ListView)findViewById(R.id.listView1);
  String[] names=new String[]{"Cupcake","Donut","Eclair","Froyo","Gingerbread","Honeycomb","IceCream Sandwich"};
  listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,names));
}
 

Example 21

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: AbstractContactPickerActivity.java

  15 
vote

protected void choosePhoneNumberAndDial(final CharSequence contactName,final String id){
  List<String> phones=extractPhones(id);
  phones.addAll(extractSipNumbers(id));
switch (phones.size()) {
case 0:
    String msg=String.format(getString(R.string.no_phone_numbers),contactName);
  Toast.makeText(this,msg,Toast.LENGTH_LONG).show();
break;
case 1:
returnSelectedValues(phones.get(0),contactName.toString(),getPhotoUri(id));
break;
default :
AlertDialog.Builder builder=new AlertDialog.Builder(this);
final ArrayAdapter<String> pAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,phones);
builder.setTitle(String.format(getString(R.string.title_numbers_dialog),contactName));
builder.setAdapter(pAdapter,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
returnSelectedValues(pAdapter.getItem(which),contactName.toString(),getPhotoUri(id));
}
}
);
builder.setCancelable(true);
builder.setNeutralButton("cancel",new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
dialog.dismiss();
}
}
);
AlertDialog dialog=builder.create();
dialog.show();
}
}
 

Example 22

From project androidannotations, under directory /AndroidAnnotations/functional-test-1-5/src/main/java/com/googlecode/androidannotations/test15/.

Source file: ItemClicksHandledActivity.java

  15 
vote

@AfterViews void initView(){
  adapter=ArrayAdapter.createFromResource(this,R.array.planets_array,R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  listView.setAdapter(adapter);
  spinnerWithArgument.setAdapter(adapter);
  listViewWithArgument.setAdapter(adapter);
  listViewWithPosition.setAdapter(adapter);
  listViewWithOneParam.setAdapter(adapter);
  spinnerItemClicked=false;
  listViewItemClicked=false;
  listViewWithPositionItemSelected=false;
  listViewWithPositionClickedPosition=0;
  listViewWithOneParamItemSelected=false;
  listViewWithPositionItemSelectedPosition=0;
}
 

Example 23

From project AndroidBillingLibrary, under directory /DungeonsRedux/src/net/robotmedia/billing/example/.

Source file: Dungeons.java

  15 
vote

private void updateOwnedItems(){
  List<Transaction> transactions=BillingController.getTransactions(this);
  final ArrayList<String> ownedItems=new ArrayList<String>();
  for (  Transaction t : transactions) {
    if (t.purchaseState == PurchaseState.PURCHASED) {
      ownedItems.add(t.productId);
    }
  }
  mCatalogAdapter.setOwnedItems(ownedItems);
  final ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,R.layout.item_row,R.id.item_name,ownedItems);
  mOwnedItemsTable.setAdapter(adapter);
}
 

Example 24

From project AndroidExamples, under directory /RSSExample/src/com/robertszkutak/androidexamples/rss/.

Source file: RSSExampleActivity.java

  15 
vote

private void UpdateDisplay(){
  ListView itemlist=(ListView)findViewById(R.id.listView1);
  if (feed == null)   return;
  ArrayAdapter<RSSItem> adapter=new ArrayAdapter<RSSItem>(this,android.R.layout.simple_list_item_1,feed.getAllItems());
  itemlist.setAdapter(adapter);
  itemlist.setOnItemClickListener(this);
  itemlist.setSelection(0);
}
 

Example 25

From project AndroidLab, under directory /samples/AndroidLdapClient/src/com/unboundid/android/ldap/client/.

Source file: AddServer.java

  15 
vote

/** 
 * Performs all necessary processing when this activity is started or resumed.
 */
@Override() protected void onResume(){
  logEnter(LOG_TAG,"onResume");
  super.onResume();
  setContentView(R.layout.layout_define_server);
  setTitle(R.string.activity_label);
  final EditText idField=(EditText)findViewById(R.id.layout_define_server_field_id);
  idField.setText(id);
  final EditText hostField=(EditText)findViewById(R.id.layout_define_server_field_host);
  hostField.setText(host);
  final EditText portField=(EditText)findViewById(R.id.layout_define_server_field_port);
  portField.setText(String.valueOf(port));
  final Spinner secSpinner=(Spinner)findViewById(R.id.layout_define_server_spinner_security);
  final ArrayAdapter<CharSequence> secAdapter=ArrayAdapter.createFromResource(this,R.array.add_server_security_type_list,android.R.layout.simple_spinner_item);
  secAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  secSpinner.setAdapter(secAdapter);
  if (useSSL) {
    secSpinner.setSelection(1);
  }
 else   if (useStartTLS) {
    secSpinner.setSelection(2);
  }
 else {
    secSpinner.setSelection(0);
  }
  final EditText bindDNField=(EditText)findViewById(R.id.layout_define_server_field_bind_dn);
  bindDNField.setText(bindDN);
  final EditText bindPWField=(EditText)findViewById(R.id.layout_define_server_field_bind_pw);
  bindPWField.setText(bindPW);
  final EditText baseDNField=(EditText)findViewById(R.id.layout_define_server_field_base);
  baseDNField.setText(baseDN);
  final Button testButton=(Button)findViewById(R.id.layout_define_server_button_server_test);
  testButton.setOnClickListener(this);
  final Button saveButton=(Button)findViewById(R.id.layout_define_server_button_server_save);
  saveButton.setOnClickListener(this);
}
 

Example 26

From project androidquery, under directory /demo/src/com/androidquery/test/image/.

Source file: ImageGridFragment.java

  15 
vote

private void render(List<Photo> entries){
  AQUtility.debug("render setup");
  ArrayAdapter<Photo> aa=new ArrayAdapter<Photo>(getActivity(),R.layout.grid_item2,entries){
    public View getView(    int position,    View convertView,    ViewGroup parent){
      if (convertView == null) {
        convertView=aq.inflate(convertView,R.layout.grid_item2,parent);
      }
      Photo photo=getItem(position);
      AQuery aq=aq2.recycle(convertView);
      String tbUrl=photo.tb;
      if (aq.shouldDelay(position,convertView,parent,tbUrl)) {
        aq.id(R.id.tb).clear();
      }
 else {
        aq.id(R.id.tb).image(tbUrl,true,true,200,0,null,0,0);
      }
      return convertView;
    }
  }
;
  aq.id(R.id.grid).adapter(aa);
}
 

Example 27

From project Android_1, under directory /Fragments/simple/src/novoda/demo/fragments/list/frags/.

Source file: List.java

  15 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setListAdapter(new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,Constants.ITEMS));
  View detailsFrame=getActivity().findViewById(R.id.frame_details);
  mHasDetailsFrame=(detailsFrame != null) && (detailsFrame.getVisibility() == View.VISIBLE);
  if (savedInstanceState != null) {
    mPositionChecked=savedInstanceState.getInt("curChoice",0);
    mPositionShown=savedInstanceState.getInt("shownChoice",-1);
  }
  if (mHasDetailsFrame) {
    getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    upateDetailsFragment(mPositionChecked);
  }
}
 

Example 28

From project android_8, under directory /src/com/defuzeme/playqueue/.

Source file: PlayQueue.java

  15 
vote

public void initialize(){
  this.setListeners();
  items=new ArrayAdapter<StreamObject>(this,DefuzeMe._queueTracks.size());
  for (int i=1; i < DefuzeMe._queueTracks.size(); i++)   items.add(DefuzeMe._queueTracks.get(i));
  this._adapter=new QueueAdapter(this,new int[]{layout.play_queue_item},new int[]{id.TextView01,id.TextView02},items);
  this.setListAdapter(this._adapter);
  this.listView=(DnDList)getListView();
  this.setCurrentTrackInfos();
  if (DefuzeMe._playingStatus == true)   ((ImageView)findViewById(id.playPauseButton)).setImageResource(drawable.ic_media_pause);
 else   ((ImageView)findViewById(id.playPauseButton)).setImageResource(drawable.ic_media_play);
  if (this.listView instanceof DnDList) {
    ((DnDList)this.listView).setDropListener(mDropListener);
    ((DnDList)this.listView).setRemoveListener(mRemoveListener);
    ((DnDList)this.listView).setDragListener(mDragListener);
  }
  registerForContextMenu(this.listView);
}
 

Example 29

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: BandMode.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  setContentView(R.layout.band_mode);
  setTitle(getString(R.string.band_mode_title));
  getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.WRAP_CONTENT);
  mPhone=PhoneFactory.getDefaultPhone();
  mBandList=(ListView)findViewById(R.id.band);
  mBandListAdapter=new ArrayAdapter<BandListItem>(this,android.R.layout.simple_list_item_1);
  mBandList.setAdapter(mBandListAdapter);
  mBandList.setOnItemClickListener(mBandSelectionHandler);
  loadBandList();
}
 

Example 30

From project Android_NFC_FelicaEdit, under directory /src/jp/co/yumemi/rd/felicaedit/.

Source file: EditBlock.java

  15 
vote

/** 
 * ??????????
 */
private void updateList(){
  if (blockData == null)   return;
  List<String> byteList=new ArrayList<String>();
  for (int i=0; i < blockData.length; i++) {
    byteList.add(String.format("%02X: %02X",i,blockData[i]));
  }
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,byteList);
  ListView lv=(ListView)findViewById(R.id.data_list_view);
  lv.setAdapter(adapter);
}
 

Example 31

From project android_packages_apps_Tag, under directory /canon/src/com/android/apps/tagcanon/.

Source file: TagCanon.java

  15 
vote

@Override public void onCreate(Bundle savedState){
  super.onCreate(savedState);
  ArrayAdapter<TagDescription> adapter=new ArrayAdapter<TagDescription>(this,android.R.layout.simple_list_item_1,android.R.id.text1);
  adapter.add(new TagDescription("Image",buildImageMessages()));
  adapter.add(new TagDescription("Real NFC message",MockNdefMessages.REAL_NFC_MSG));
  adapter.add(new TagDescription("Call Google",MockNdefMessages.CALL_GOOGLE));
  adapter.add(new TagDescription("English text",MockNdefMessages.ENGLISH_PLAIN_TEXT));
  adapter.add(new TagDescription("Send text message",MockNdefMessages.SEND_TEXT_MESSAGE));
  adapter.add(new TagDescription("SmartPoster URL & text",MockNdefMessages.SMART_POSTER_URL_AND_TEXT));
  adapter.add(new TagDescription("SmartPoster URL",MockNdefMessages.SMART_POSTER_URL_NO_TEXT));
  adapter.add(new TagDescription("VCARD",MockNdefMessages.VCARD));
  adapter.add(new TagDescription("URI",MockNdefMessages.URI));
  setListAdapter(adapter);
  mAdapter=adapter;
}
 

Example 32

From project androvoip, under directory /src/org/androvoip/ui/.

Source file: Settings.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.settings);
  Intent intent=getIntent();
  mAccount=(Account)intent.getSerializableExtra("account");
  if (mAccount == null) {
    finish();
  }
  ((Button)findViewById(R.id.save)).setOnClickListener(this);
  ((Button)findViewById(R.id.cancel)).setOnClickListener(this);
  ArrayAdapter<String> spinnerArrayAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,mProtocols);
  spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  ((Spinner)findViewById(R.id.protocol_spinner)).setAdapter(spinnerArrayAdapter);
  for (int i=0; i < mProtocols.length; i++) {
    if (mProtocols[i].equals(mAccount.getProtocol().toString())) {
      ((Spinner)findViewById(R.id.protocol_spinner)).setSelection(i);
      break;
    }
  }
  setField(R.id.host_text,mAccount.getHost());
  setField(R.id.username_text,mAccount.getUserName());
  setField(R.id.password_text,mAccount.getPassword());
  bindService(new Intent().setClassName("org.androvoip","org.androvoip.iax2.IAX2Service"),this,BIND_AUTO_CREATE);
}
 

Example 33

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/settings/.

Source file: UserDictionaryEditorActivity.java

  15 
vote

private void fillLangsSpinner(){
  new UserWordsEditorAsyncTask(this){
    private ArrayList<String> mLangsList;
    @Override protected Void doInBackground(    Void... params){
      mLangsList=new ArrayList<String>();
      ArrayList<KeyboardAddOnAndBuilder> keyboards=KeyboardFactory.getAllAvailableKeyboards(getApplicationContext());
      for (      KeyboardAddOnAndBuilder kbd : keyboards) {
        String locale=kbd.getKeyboardLocale();
        if (TextUtils.isEmpty(locale))         continue;
        if (mLangsList.contains(locale))         continue;
        Log.d(TAG,"Adding locale " + locale + " to editor.");
        mLangsList.add(locale);
      }
      return null;
    }
    @Override protected void applyResults(    Void result){
      ArrayAdapter<CharSequence> adapter=new ArrayAdapter<CharSequence>(UserDictionaryEditorActivity.this,android.R.layout.simple_spinner_item);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      for (      String lang : mLangsList)       adapter.add(lang);
      mLangs.setAdapter(adapter);
    }
  }
.execute();
}
 

Example 34

From project apg, under directory /src/org/thialfihar/android/apg/ui/widget/.

Source file: KeyEditor.java

  15 
vote

@Override protected void onFinishInflate(){
  setDrawingCacheEnabled(true);
  setAlwaysDrawnWithCacheEnabled(true);
  mAlgorithm=(TextView)findViewById(R.id.algorithm);
  mKeyId=(TextView)findViewById(R.id.keyId);
  mCreationDate=(TextView)findViewById(R.id.creation);
  mExpiryDateButton=(Button)findViewById(R.id.expiry);
  mUsage=(Spinner)findViewById(R.id.usage);
  Choice choices[]={new Choice(Id.choice.usage.sign_only,getResources().getString(R.string.choice_signOnly)),new Choice(Id.choice.usage.encrypt_only,getResources().getString(R.string.choice_encryptOnly)),new Choice(Id.choice.usage.sign_and_encrypt,getResources().getString(R.string.choice_signAndEncrypt))};
  ArrayAdapter<Choice> adapter=new ArrayAdapter<Choice>(getContext(),android.R.layout.simple_spinner_item,choices);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mUsage.setAdapter(adapter);
  mDeleteButton=(ImageButton)findViewById(R.id.delete);
  mDeleteButton.setOnClickListener(this);
  setExpiryDate(null);
  mExpiryDateButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      GregorianCalendar date=mExpiryDate;
      if (date == null) {
        date=new GregorianCalendar();
      }
      DatePickerDialog dialog=new DatePickerDialog(getContext(),mExpiryDateSetListener,date.get(Calendar.YEAR),date.get(Calendar.MONTH),date.get(Calendar.DAY_OF_MONTH));
      dialog.setCancelable(true);
      dialog.setButton(Dialog.BUTTON_NEGATIVE,getContext().getString(R.string.btn_noDate),new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          setExpiryDate(null);
        }
      }
);
      dialog.show();
    }
  }
);
  super.onFinishInflate();
}
 

Example 35

From project appdriver, under directory /android/sample-aut/simplelayouts/src/com/google/android/testing/nativedriver/simplelayouts/.

Source file: SpinnersActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstance){
  super.onCreate(savedInstance);
  setContentView(R.layout.spinners);
  Spinner planetSpinner=(Spinner)findViewById(R.id.planet_spinner);
  ArrayAdapter<CharSequence> planetAdapter=ArrayAdapter.createFromResource(this,R.array.planets,android.R.layout.simple_spinner_item);
  planetAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  planetSpinner.setAdapter(planetAdapter);
  Spinner starSpinner=(Spinner)findViewById(R.id.star_spinner);
  ArrayAdapter<CharSequence> starAdapter=ArrayAdapter.createFromResource(this,R.array.stars,android.R.layout.simple_spinner_item);
  starAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  starSpinner.setAdapter(starAdapter);
}
 

Example 36

From project apps-for-android, under directory /BTClickLinkCompete/src/net/clc/bt/.

Source file: ServerListActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  self=this;
  arrayAdapter=new ArrayAdapter<String>(self,R.layout.text);
  ListView lv=self.getListView();
  lv.setAdapter(arrayAdapter);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      myBt.cancelDiscovery();
      String btDeviceInfo=((TextView)arg1).getText().toString();
      String btHardwareAddress=btDeviceInfo.substring(btDeviceInfo.length() - 17);
      Intent i=new Intent();
      i.putExtra(EXTRA_SELECTED_ADDRESS,btHardwareAddress);
      self.setResult(Activity.RESULT_OK,i);
      finish();
    }
  }
);
  myBt=BluetoothAdapter.getDefaultAdapter();
  myBt.startDiscovery();
  self.setResult(Activity.RESULT_CANCELED);
}
 

Example 37

From project Backyard-Brains-Android-App, under directory /src/com/backyardbrains/.

Source file: BackyardBrainsConfigurationActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.configuration_screen);
  final String prefsname=getResources().getString(R.string.global_prefs);
  speedPrefsKey=getResources().getString(R.string.microphone_read_speed);
  prefs=getSharedPreferences(prefsname,MODE_PRIVATE);
  CharSequence preferencesSpeed=prefs.getString(speedPrefsKey,"1");
  Log.d("Config Screen","read MicrophoneReadSpeed of " + preferencesSpeed);
  Spinner spinner=(Spinner)findViewById(R.id.read_speed_spinner);
  ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.speeds_array,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  spinner.setSelection(adapter.getPosition(preferencesSpeed),true);
  spinner.setOnItemSelectedListener(new SpeedSelectedListener());
}
 

Example 38

From project BBC-News-Reader, under directory /src/com/digitallizard/bbcnewsreader/.

Source file: CategoryChooserActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.category_choice);
  listView=(ListView)this.findViewById(R.id.categoryChoiceListView);
  allCategoryNames=getResources().getStringArray(R.array.category_names);
  listView.setAdapter(new ArrayAdapter<String>(this,R.layout.category_choice_item,allCategoryNames));
  listView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
  boolean[] categoryBooleans=getIntent().getBooleanArrayExtra(KEY_CATEGORY_BOOLEANS);
  for (int i=0; i < categoryBooleans.length; i++) {
    listView.setItemChecked(i,categoryBooleans[i]);
  }
}
 

Example 39

From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/beintoosdkui/.

Source file: BeintooListViewDialogES.java

  15 
vote

@SuppressWarnings("unchecked") public void updateListView(@SuppressWarnings("rawtypes") ArrayAdapter a){
  try {
    if (start == 0 && a != null) {
      adapter=a;
      adapter.setNotifyOnChange(false);
      listView.setAdapter(adapter);
    }
    adapter.notifyDataSetChanged();
    if (start == 0) {
      listView.setVisibility(View.VISIBLE);
      if (objectItems.size() == 0 && this.optionalEmptyMessage != null)       addEmptyMessage();
    }
 else {
      listView.findViewWithTag(2000).setVisibility(View.GONE);
    }
    if (hasReachedEnd) {
      listView.removeFooterView(listView.findViewWithTag(2000));
    }
    if (start == 0)     hideLoading();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
 

Example 40

From project BibleQuote-for-Android, under directory /src/com/BibleQuote/activity/.

Source file: LibraryActivity.java

  15 
vote

private ArrayAdapter<String> getChapterAdapter(){
  chapters=new ArrayList<String>();
  try {
    chapters=myLibrarian.getChaptersList(moduleID,bookID);
  }
 catch (  BookNotFoundException e) {
    ExceptionHelper.onBookNotFoundException(e,this,TAG);
  }
catch (  OpenModuleException e) {
    ExceptionHelper.onOpenModuleException(e,this,TAG);
  }
  return new ArrayAdapter<String>(this,R.layout.chapter_item,R.id.chapter,chapters);
}
 

Example 41

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: PeerListFragment.java

  15 
vote

@Override public void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  adapter=new ArrayAdapter<Peer>(activity,0){
    @Override public View getView(    final int position,    View row,    final ViewGroup parent){
      if (row == null)       row=getLayoutInflater(null).inflate(android.R.layout.simple_list_item_2,null);
      final Peer peer=getItem(position);
      final TextView rowText1=(TextView)row.findViewById(android.R.id.text1);
      rowText1.setText(peer.getAddress().toString());
      final TextView rowText2=(TextView)row.findViewById(android.R.id.text2);
      rowText2.setText(peer.getVersionMessage().toString());
      return row;
    }
  }
;
  setListAdapter(adapter);
}
 

Example 42

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: BookEditLoaned.java

  15 
vote

/** 
 * Display the loan to page. It is slightly different to the existing loan page
 */
private void loanTo(){
  setContentView(R.layout.edit_book_loan);
  AutoCompleteTextView mUserText=(AutoCompleteTextView)findViewById(R.id.loan_to_who);
  try {
    ArrayAdapter<String> series_adapter=new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,getFriends());
    mUserText.setAdapter(series_adapter);
  }
 catch (  Exception e) {
    Logger.logError(e);
  }
  Button mConfirmButton=(Button)findViewById(R.id.confirm);
  mConfirmButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      String friend=saveLoan();
      setResult(RESULT_OK);
      loaned(friend);
    }
  }
);
}
 

Example 43

From project btmidi, under directory /BluetoothMidi/src/com/noisepages/nettoyeur/bluetooth/.

Source file: DeviceListActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.device_list);
  setResult(Activity.RESULT_CANCELED);
  pairedDevicesAdapter=new ArrayAdapter<String>(this,R.layout.device_name);
  ListView pairedListView=(ListView)findViewById(R.id.paired_devices);
  pairedListView.setAdapter(pairedDevicesAdapter);
  pairedListView.setOnItemClickListener(clickListener);
  btAdapter=BluetoothAdapter.getDefaultAdapter();
  Set<BluetoothDevice> pairedDevices=btAdapter.getBondedDevices();
  empty=pairedDevices.isEmpty();
  if (!empty) {
    findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
    for (    BluetoothDevice device : pairedDevices) {
      pairedDevicesAdapter.add(device.getName() + "\n" + device.getAddress());
    }
  }
 else {
    String noDevices=getResources().getText(R.string.none_paired).toString();
    pairedDevicesAdapter.add(noDevices);
  }
}
 

Example 44

From project BusFollower, under directory /src/net/argilo/busfollower/.

Source file: RouteChooserActivity.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.routechooser);
  db=((BusFollowerApplication)getApplication()).getDatabase();
  Util.setDisplayHomeAsUpEnabled(this,true);
  stop=(Stop)getIntent().getSerializableExtra("stop");
  GetRouteSummaryForStopResult result=(GetRouteSummaryForStopResult)getIntent().getSerializableExtra("result");
  routes=result.getRoutes();
  setListAdapter(new ArrayAdapter<Route>(this,android.R.layout.simple_list_item_1,routes));
  setTitle(getString(R.string.stop_number) + " " + stop.getNumber()+ (stop.getName() != null ? " " + stop.getName() : ""));
  if (savedInstanceState != null) {
    if (task != null) {
      task.setActivityContext(this);
    }
  }
}
 

Example 45

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/common/.

Source file: MessageContainer.java

  15 
vote

public synchronized ArrayAdapter<String> getMessageAdapter(Context context){
  if (messageAdapter == null) {
    messageAdapter=new ArrayAdapter<String>(context,android.R.layout.simple_spinner_item);
    messageAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    messageAdapter.add(context.getString(R.string.broadcast_nothing_selected));
    Set<String> messageSet=receiverMap.keySet();
    for (    String message : messageSet) {
      messageAdapter.add(message);
    }
  }
  return messageAdapter;
}
 

Example 46

From project CineShowTime-Android, under directory /Libraries/CineShowTime/src/com/binomed/showtime/android/layout/dialogs/sort/.

Source file: ListDialog.java

  15 
vote

/** 
 * @see android.app.Dialog#onCreate(android.os.Bundle)
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.dialog_sort);
  listSort=(ListView)findViewById(R.id.sortListSortDialog);
  listSort.setOnItemClickListener(listener);
  ArrayAdapter<String> adapter=null;
  if (ressourceValue != -1) {
    adapter=new ArrayAdapter<String>(mainContext,android.R.layout.simple_list_item_1,mainContext.getResources().getStringArray(ressourceValue));
  }
 else {
    adapter=new ArrayAdapter<String>(mainContext,android.R.layout.simple_list_item_1,values);
  }
  listSort.setAdapter(adapter);
}
 

Example 47

From project com.juick.android, under directory /src/com/juick/android/.

Source file: MainActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  Utils.updateThemeHolo(this);
  super.onCreate(savedInstanceState);
  Intent intent=getIntent();
  if (intent != null) {
    Uri uri=intent.getData();
    if (uri != null && uri.getPathSegments().size() > 0 && parseUri(uri)) {
      return;
    }
  }
  if (!Utils.hasAuth(this)) {
    startActivityForResult(new Intent(this,SignInActivity.class),ACTIVITY_SIGNIN);
    return;
  }
  startCheckUpdates(this);
  ActionBar bar=getSupportActionBar();
  bar.setDisplayShowHomeEnabled(false);
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  bar.setListNavigationCallbacks(ArrayAdapter.createFromResource(this,R.array.messagesLists,android.R.layout.simple_list_item_1),this);
  setContentView(R.layout.messages);
}
 

Example 48

From project Common-Sense-Net-2, under directory /RealFarm/src/com/commonsensenet/realfarm/admin/.

Source file: UserListActivity.java

  15 
vote

/** 
 * Populates the listView
 */
public void populateUserList(){
  mListView=(ListView)findViewById(R.id.admin_user_listview_list);
  mListView.setItemsCanFocus(true);
  ArrayList<String> emptyList=new ArrayList<String>();
  mListAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,emptyList);
  mListView.setAdapter(mListAdapter);
  mUserList=mDataProvider.getUsersByDeviceId(((RealFarmApp)getApplication()).getDeviceId());
  for (int x=0; x < mUserList.size(); x++) {
    mListAdapter.add(mUserList.get(x).getFirstname() + " " + mUserList.get(x).getLastname());
  }
  mListAdapter.notifyDataSetChanged();
}
 

Example 49

From project connectbot, under directory /src/sk/vx/connectbot/service/.

Source file: TerminalKeyListener.java

  15 
vote

public void urlScan(View v){
  List<String> urls=bridge.scanForURLs();
  Dialog urlDialog=new Dialog(v.getContext());
  urlDialog.setTitle(R.string.console_menu_urlscan);
  ListView urlListView=new ListView(v.getContext());
  URLItemListener urlListener=new URLItemListener(v.getContext());
  urlListView.setOnItemClickListener(urlListener);
  urlListView.setAdapter(new ArrayAdapter<String>(v.getContext(),android.R.layout.simple_list_item_1,urls));
  urlDialog.setContentView(urlListView);
  urlDialog.show();
}
 

Example 50

From project cow, under directory /libs/ActionBarSherlock/samples/demos/src/com/actionbarsherlock/sample/demos/.

Source file: ListNavigation.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.text);
  getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  ArrayAdapter<CharSequence> list=ArrayAdapter.createFromResource(this,R.array.locations,android.R.layout.simple_dropdown_item_1line);
  list.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  getSupportActionBar().setListNavigationCallbacks(list,this);
}
 

Example 51

From project creamed_glacier_app_settings, under directory /src/com/android/settings/.

Source file: BandMode.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  setContentView(R.layout.band_mode);
  setTitle(getString(R.string.band_mode_title));
  getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.WRAP_CONTENT);
  mPhone=PhoneFactory.getDefaultPhone();
  mBandList=(ListView)findViewById(R.id.band);
  mBandListAdapter=new ArrayAdapter<BandListItem>(this,android.R.layout.simple_list_item_1);
  mBandList.setAdapter(mBandListAdapter);
  mBandList.setOnItemClickListener(mBandSelectionHandler);
  loadBandList();
}
 

Example 52

From project Cura, under directory /src/com/cura/.

Source file: FavoriteCommands.java

  15 
vote

public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.favoritecommands);
  Bundle extras=getIntent().getExtras();
  if (extras != null) {
    userTemp=extras.getParcelable("user");
  }
  this.setTitle(R.string.favoritesWelcome + userTemp.getUsername());
  dbHelper=new DbHelper(this);
  db=dbHelper.getReadableDatabase();
  Cursor c=db.rawQuery("select * from commandTable",null);
  favoriteCommands=new String[c.getCount()];
  int counter=0;
  if (c != null) {
    if (c.moveToFirst()) {
      do {
        favoriteCommands[counter]=c.getString(c.getColumnIndex("command"));
        counter++;
      }
 while (c.moveToNext());
    }
  }
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,favoriteCommands);
  setListAdapter(adapter);
  registerForContextMenu(getListView());
}