Java Code Examples for android.widget.ListView

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 Amantech, under directory /Android/CloudAppStudioAndroid/src/com/cloudappstudio/activities/.

Source file: LoginActivity.java

  33 
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 2

From project agit, under directory /agit-integration-tests/src/main/java/com/madgag/agit/.

Source file: RDTBranchListActivityTest.java

  32 
vote

public void testShouldShowBranchListWithoutExplosion() throws Exception {
  Repository repository=helper(getInstrumentation()).unpackRepo("small-repo.with-branches.zip");
  setActivityIntent(listIntent(repository,"branch"));
  final RDTBranchListActivity activity=getActivity();
  ListView listView=activity.getListView();
  checkCanSelectEveryItemInNonEmpty(listView);
}
 

Example 3

From project alljoyn_java, under directory /samples/android/contacts/ContactsService/src/org/alljoyn/bus/samples/contacts_service/.

Source file: ContactsService.java

  32 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  mListViewArrayAdapter=new ArrayAdapter<String>(this,android.R.layout.test_list_item);
  ListView lv=(ListView)findViewById(R.id.ListView);
  lv.setAdapter(mListViewArrayAdapter);
  Message msg=mHandler.obtainMessage(MESSAGE_ACTION,"");
  mHandler.sendMessage(msg);
  HandlerThread busThread=new HandlerThread("BusHandler");
  busThread.start();
  mBusHandler=new BusHandler(busThread.getLooper());
  mBusHandler.sendEmptyMessage(BusHandler.CONNECT);
}
 

Example 4

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

Source file: BookmarkLabels.java

  32 
vote

/** 
 * get checked status of all labels
 * @param labelsToCheck
 */
private List<LabelDto> getCheckedLabels(){
  ListView listView=getListView();
  List<LabelDto> checkedLabels=new ArrayList<LabelDto>();
  for (int i=0; i < labels.size(); i++) {
    if (listView.isItemChecked(i)) {
      LabelDto label=labels.get(i);
      checkedLabels.add(label);
      Log.d(TAG,"Selected " + label.getName());
    }
  }
  return checkedLabels;
}
 

Example 5

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

Source file: Tmts.java

  32 
vote

/** 
 * Return a  {@link TmtsListView} by the given name.
 * @param name String name of view id, the string after @+id/ defined in layout files.
 * @return {@link TmtsListView} with the given name.
 * @throws Exception Exception
 */
TmtsListView getTmtsListView(String name) throws Exception {
  Log.i(LOG_TAG,"getTmtsListView: " + name);
  ListView listView=(ListView)getView(name,ListView.class);
  printLog(listView,name,"getTmtsListView");
  TmtsListView tmtsListView=new TmtsListView(inst,listView);
  tmtsListView.init(this.clickUtils);
  return tmtsListView;
}
 

Example 6

From project android-bankdroid, under directory /src/com/liato/bankdroid/appwidget/.

Source file: WidgetConfigureActivity.java

  32 
vote

private void refreshView(){
  ArrayList<Bank> banks=BankFactory.banksFromDb(this,true);
  if (banks.size() > 0) {
    findViewById(R.id.chkTransperantBackground).setVisibility(View.VISIBLE);
    findViewById(R.id.txtAccountsDesc).setVisibility(View.GONE);
    ListView lv=(ListView)findViewById(R.id.lstAccountsList);
    adapter=new AccountsAdapter(this,false);
    adapter.setGroups(banks);
    lv.setAdapter(adapter);
  }
}
 

Example 7

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

Source file: CommentEditorActivity.java

  32 
vote

private void setupListView(){
  initDataArray();
  setListAdapter(new ArrayAdapter<String>(this,R.layout.attachment_list_item,data));
  ListView lv=getListView();
  lv.setTextFilterEnabled(true);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> arg0,    View view,    int arg2,    long arg3){
      Toast.makeText(getApplicationContext(),((TextView)view).getText(),Toast.LENGTH_SHORT).show();
    }
  }
);
}
 

Example 8

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: DialogHandler.java

  32 
vote

private View createHoldingFileDialog(){
  getDialog().getWindow().setGravity(Gravity.LEFT | Gravity.TOP);
  getDialog().setTitle("Holding " + mFiles.size() + " files");
  ListView list=new ListView(mContext);
  list.setAdapter(new DialogListAdapter(mContext,R.layout.dir_list_layout,mFiles));
  return list;
}
 

Example 9

From project android-joedayz, under directory /Proyectos/client/src/org/springframework/android/showcase/.

Source file: AbstractMenuActivity.java

  32 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.menu_activity_layout);
  final TextView textViewDescription=(TextView)this.findViewById(R.id.text_view_description);
  textViewDescription.setText(getDescription());
  final ListView listViewMenu=(ListView)this.findViewById(R.id.list_view_menu_items);
  listViewMenu.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,getMenuItems()));
  listViewMenu.setOnItemClickListener(getMenuOnItemClickListener());
}
 

Example 10

From project android-pulltorefresh, under directory /library/src/com/handmark/pulltorefresh/library/.

Source file: PullToRefreshListView.java

  32 
vote

protected ListView createListView(Context context,AttributeSet attrs){
  final ListView lv;
  if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
    lv=new InternalListViewSDK9(context,attrs);
  }
 else {
    lv=new InternalListView(context,attrs);
  }
  return lv;
}
 

Example 11

From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.

Source file: WindowList.java

  32 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  ListView listView=getListView();
  View newWindow=getLayoutInflater().inflate(R.layout.window_list_new_window,listView,false);
  listView.addHeaderView(newWindow,null,true);
  setResult(RESULT_CANCELED);
  if (AndroidCompat.SDK >= 11) {
    ActionBarCompat bar=ActivityCompat.getActionBar(this);
    if (bar != null) {
      bar.setDisplayOptions(ActionBarCompat.DISPLAY_HOME_AS_UP,ActionBarCompat.DISPLAY_HOME_AS_UP);
    }
  }
}
 

Example 12

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

Source file: WidgetListActivity.java

  31 
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 13

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

Source file: DevicesActivity.java

  31 
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 14

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AASettings.java

  31 
vote

/** 
 * Called when the activity is created and put into memory. This is where all GUI elements should be set up and any other member variables that is used throughout the class
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.settings_main);
  TextView tv=(TextView)findViewById(R.id.AATitle);
  Typeface face=Typeface.createFromAsset(getAssets(),"fonts/WREXHAM_.TTF");
  tv.setTypeface(face);
  settings=this.getSharedPreferences("settings",0);
  adapter=new ColorAdapter(this);
  this.setListAdapter(adapter);
  ListView lv=getListView();
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      showDialog(position);
    }
  }
);
  sb_freq=(SeekBar)this.findViewById(R.id.sb_freq);
  tv_freq=(TextView)this.findViewById(R.id.tv_freq);
  sb_freq.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
    @Override public void onStopTrackingTouch(    SeekBar seekBar){
    }
    @Override public void onStartTrackingTouch(    SeekBar seekBar){
    }
    @Override public void onProgressChanged(    SeekBar seekBar,    int progress,    boolean fromUser){
      tv_freq.setText((progress + 1) + " hour(s)");
    }
  }
);
  sb_freq.setProgress((int)settings.getLong("freq",2) - 1);
}
 

Example 15

From project Airports, under directory /src/com/nadmm/airports/afd/.

Source file: SearchActivity.java

  31 
vote

@SuppressWarnings("deprecation") private void showResults(String query){
  Cursor c=managedQuery(AirportsProvider.CONTENT_URI,null,null,new String[]{query},null);
  int count=c.getCount();
  startManagingCursor(c);
  setContentView(R.layout.list_view_layout);
  ListView listView=(ListView)findViewById(android.R.id.list);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Cursor c=mListAdapter.getCursor();
      String siteNumber=c.getString(c.getColumnIndex(Airports.SITE_NUMBER));
      Intent intent=new Intent(SearchActivity.this,AirportDetailsActivity.class);
      intent.putExtra(Airports.SITE_NUMBER,siteNumber);
      startActivity(intent);
    }
  }
);
  mListAdapter=new AirportsCursorAdapter(this,c);
  listView.setAdapter(mListAdapter);
  getSupportActionBar().setSubtitle(getResources().getQuantityString(R.plurals.search_entry_found,count,count,query));
}
 

Example 16

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/fragments/.

Source file: AmenListFragment.java

  31 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  final ListView listView=getListView();
  if (listView instanceof PullToRefreshListView) {
    PullToRefreshListView pullToRefreshListView=(PullToRefreshListView)listView;
    pullToRefreshListView.setOnRefreshListener(new PullToRefreshListView.OnRefreshListener(){
      public void onRefresh(){
        Log.v(TAG,"onRefresh()");
        new GetDataTask(getActivity()).execute();
      }
    }
);
    noPull=false;
  }
 else {
    noPull=true;
  }
}
 

Example 17

From project andlytics, under directory /src/com/github/andlyticsproject/.

Source file: ExportActivity.java

  31 
vote

private void setupView(){
  View closeButton=(View)this.findViewById(R.id.export_dialog_close_button);
  closeButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      finish();
    }
  }
);
  final Context context=this;
  View exportButton=(View)this.findViewById(R.id.export_dialog_export_button);
  exportButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (!android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
        Toast.makeText(context,context.getString(R.string.export_no_sdcard),Toast.LENGTH_LONG).show();
        return;
      }
      if (exportPackageNames.isEmpty()) {
        Toast.makeText(context,context.getString(R.string.export_no_app),Toast.LENGTH_LONG).show();
        return;
      }
      File exportFile=StatsCsvReaderWriter.getExportFileForAccount(Preferences.getAccountName(ExportActivity.this));
      if (exportFile.exists()) {
        ConfirmExportDialogFragment.newInstance(exportFile.getName()).show(getSupportFragmentManager(),"confirmExportDialog");
      }
 else {
        startExport();
      }
    }
  }
);
  ListView lv=(ListView)this.findViewById(R.id.list_view_id);
  lv.addHeaderView(layoutInflater.inflate(R.layout.export_list_header,null));
  lv.setAdapter(adapter);
}
 

Example 18

From project Android, under directory /app/src/main/java/com/github/mobile/ui/issue/.

Source file: AssigneeDialogFragment.java

  31 
vote

@Override public Dialog onCreateDialog(final Bundle savedInstanceState){
  Activity activity=getActivity();
  Bundle arguments=getArguments();
  final AlertDialog dialog=createDialog();
  dialog.setButton(BUTTON_NEGATIVE,activity.getString(string.cancel),this);
  dialog.setButton(BUTTON_NEUTRAL,activity.getString(string.clear),this);
  LayoutInflater inflater=activity.getLayoutInflater();
  ListView view=(ListView)inflater.inflate(layout.dialog_list_view,null);
  view.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      onClick(dialog,position);
    }
  }
);
  ArrayList<User> choices=getChoices();
  int selected=arguments.getInt(ARG_SELECTED_CHOICE);
  UserListAdapter adapter=new UserListAdapter(inflater,choices.toArray(new User[choices.size()]),selected,loader);
  view.setAdapter(adapter);
  if (selected >= 0)   view.setSelection(selected);
  dialog.setView(view);
  return dialog;
}
 

Example 19

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: FilterSelectorDialog.java

  31 
vote

@Override protected void onStart(){
  ListView lv;
  Cursor cursor;
  String[] columns={FFXIEQSettings.C_Id,FFXIEQSettings.C_Filter};
  int[] views={0,R.id.Filter};
  FilterListAdapter adapter;
  lv=(ListView)findViewById(R.id.Filters);
  if (lv != null) {
    cursor=mSettings.getFilterCursor(columns);
    adapter=new FilterListAdapter(getContext(),R.layout.filterlistview,cursor,columns,views);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener(){
      public void onItemClick(      AdapterView<?> arg0,      View arg1,      int arg2,      long arg3){
        TextView tv=(TextView)findViewById(R.id.Filter);
        if (tv != null) {
          mId=arg3;
          tv.setText(mSettings.getFilter(arg3));
        }
      }
    }
);
  }
  super.onStart();
}
 

Example 20

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

Source file: AddMoreNodesActivity.java

  31 
vote

protected void onListItemClick(ListView l,View v,int position,long id){
  if (possibleNodes != null && possibleNodes.size() > 0) {
    if (!possibleNodes.get(position).getName().equals("External Node")) {
      LinearLayout linear=(LinearLayout)findViewById(R.id.nodes_linear_layout);
      ListView serversList=(ListView)linear.findViewById(android.R.id.list);
      View row=serversList.getChildAt(position);
      CheckBox checkBox=(CheckBox)row.findViewById(R.id.add_node_checkbox);
      if (!checkBox.isChecked()) {
        checkBox.setChecked(!checkBox.isChecked());
      }
 else {
        Server server=possibleNodes.get(position);
        String[] ipAddresses=getAllIpsOfServer(server);
        Node node=getNodeFromServer(server);
        positionOfNode=findNodePosition(node);
        lastCheckedPos=position;
        Intent viewIntent=new Intent(getContext(),AddNodeActivity.class);
        viewIntent.putExtra("ipAddresses",ipAddresses);
        viewIntent.putExtra("name",server.getName());
        if (node != null) {
          viewIntent.putExtra("node",node);
        }
        viewIntent.putExtra("weighted",loadBalancer.getAlgorithm().toLowerCase().contains("weighted"));
        startActivityForResult(viewIntent,ADD_NODE_CODE);
      }
    }
 else {
      Server server=possibleNodes.get(position);
      Node node=getNodeFromServer(server);
      positionOfNode=findNodePosition(node);
      lastCheckedPos=position;
      Intent viewIntent=new Intent(getContext(),AddExternalNodeActivity.class);
      if (node != null) {
        viewIntent.putExtra("node",node);
      }
      viewIntent.putExtra("weighted",false);
      startActivityForResult(viewIntent,ADD_EXTERNAL_NODE_CODE);
    }
  }
}
 

Example 21

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/list/view/.

Source file: SwipeListItemWrapper.java

  31 
vote

/** 
 * Check if this appears to be a swipe event. Consider it a swipe if it traverses at least a third of the screen,  and is mostly horizontal.
 */
private boolean isValidSwipe(final int x,final int y){
  final int screenWidth=getWidth();
  final int xDiff=Math.abs(x - mStartX);
  final int yDiff=Math.abs(y - mStartY);
  boolean horizontalValid=xDiff >= (screenWidth / 3);
  boolean verticalValid=yDiff > 0 && (xDiff / yDiff) > 4;
  mPosition=AdapterView.INVALID_POSITION;
  if (horizontalValid && verticalValid) {
    ListView list=(ListView)findViewById(R.id.list);
    if (list != null) {
      mPosition=list.pointToPosition(mStartX,mStartY - list.getTop());
    }
  }
  Log.d(cTag,"isValidSwipe hValid=" + horizontalValid + " vValid="+ verticalValid+ " position="+ mPosition);
  return horizontalValid && verticalValid;
}
 

Example 22

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  29 
vote

void selectionChanged(){
  if (mOnItemSelectedListener != null) {
    if (mInLayout || mBlockLayoutRequests) {
      if (mSelectionNotifier == null) {
        mSelectionNotifier=new SelectionNotifier();
      }
      post(mSelectionNotifier);
    }
 else {
      fireOnSelected();
    }
  }
  if (mSelectedPosition != ListView.INVALID_POSITION && isShown() && !isInTouchMode()) {
    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
  }
}
 

Example 23

From project aksunai, under directory /src/org/androidnerds/app/aksunai/.

Source file: Aksunai.java

  29 
vote

@Override protected void onListItemClick(ListView l,View v,int pos,long id){
  super.onListItemClick(l,v,pos,id);
  if (pos == 0) {
    newServer();
  }
 else {
    Intent i=new Intent(Aksunai.this,ChatActivity.class);
    i.putExtra("id",id);
    i.putExtra("title",mAdapter.getTitle(pos - 1));
    startActivity(i);
  }
}
 

Example 24

From project AlarmApp-Android, under directory /src/org/alarmapp/activities/.

Source file: AlarmActivity.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  LogEx.verbose("AlarmActivity onCreate");
  this.setContentView(R.layout.alarm_confirmation);
  this.lvOperationDetails=(ListView)findViewById(R.id.lvAlarmDetails);
  this.tvTitle=(TextView)findViewById(R.id.tvTitle);
  this.tvText=(TextView)findViewById(R.id.tvText);
  this.btAccept=(Button)findViewById(R.id.btAccept);
  this.btReject=(Button)findViewById(R.id.btReject);
  this.btSwitchToStatus=(Button)findViewById(R.id.btSwitchToStatus);
  this.llButtonBar=(LinearLayout)findViewById(R.id.llButtonBar);
  this.btAccept.setOnClickListener(onUpdateAlarmStatusClick(AlarmState.Accepted));
  this.btReject.setOnClickListener(onUpdateAlarmStatusClick(AlarmState.Rejeced));
  this.btSwitchToStatus.setOnClickListener(switchToClick);
  if (AlarmData.isAlarmDataBundle(savedInstanceState)) {
    alarm=AlarmData.create(savedInstanceState);
  }
 else {
    Ensure.valid(AlarmData.isAlarmDataBundle(getIntent().getExtras()));
    alarm=AlarmData.create(getIntent().getExtras());
  }
}
 

Example 25

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.

Source file: ExistingIncidentsActivity.java

  29 
vote

@Override protected void onListItemClick(ListView l,View v,int position,long id){
  Intent i=new Intent(this,ReportDetailsActivity.class);
  i.putExtra("existing",true);
  i.putExtra("event",l.getAdapter().getItem(position).toString());
  try {
    Incident incident=Incident.fromJSONObject(this,new JSONObject(l.getAdapter().getItem(position).toString()));
    if (incident.state == 'R' || incident.invalidations > 0)     return;
  }
 catch (  JSONException e) {
    Log.e(Constants.PROJECT_TAG,"JSONException in onListItemClick",e);
  }
  startActivity(i);
}
 

Example 26

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

Source file: ConflictsActivity.java

  29 
vote

/** 
 * {@inheritDoc}
 */
@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.a_list_with_buttons);
  initTitleBarViews();
  setTitleBarTitle(R.string.titleBarConflicts);
  mAddButton=(Button)findViewById(R.id.footerAdd);
  mSyncButton=(Button)findViewById(R.id.footerSync);
  mInfoButton=(ImageButton)findViewById(R.id.footerInfo);
  mWarningText=(TextView)findViewById(R.id.footerWarning);
  mList=(ListView)findViewById(android.R.id.list);
  mAddButton.setOnClickListener(getOnAddClickListener());
  mSyncButton.setOnClickListener(getOnSyncClickListener());
  mInfoButton.setOnClickListener(getOnInfoClickListener());
  UIUtils.prepareClip(mAddButton);
  UIUtils.prepareClip(mSyncButton);
  List<ConflictsEntity> data=Mobeelizer.getDatabase().list(ConflictsEntity.class);
  long conflictsCount=Mobeelizer.getDatabase().find(ConflictsEntity.class).add(MobeelizerRestrictions.isConflicted()).count();
  showWarning(conflictsCount > 0);
  mAdapter=new ConflictsSyncAdapter(this,data);
  mAdapter.sort(new ConflictsEntity());
  mList.setAdapter(mAdapter);
  mList.setOnItemClickListener(this);
}
 

Example 27

From project android-client_1, under directory /src/com/buddycloud/view/.

Source file: ChannelMessageActivity.java

  29 
vote

public void onCreate(Bundle savedInstanceState){
  node=getIntent().getData().toString().substring("channel:".length());
  super.onCreate(savedInstanceState);
  currentActivity=this;
  setContentView(R.layout.channel_layout);
  nameView=((TextView)findViewById(R.id.channel_title));
  nameView.setText("");
  nameView.setOnClickListener(new PostOnClick(-1));
  jidView=((TextView)findViewById(R.id.channel_jid));
  jidView.setOnClickListener(new PostOnClick(-1));
  listView=((ListView)findViewById(R.id.message_list));
  listView.setFadingEdgeLength(0);
  listView.setDivider(null);
  listView.setDividerHeight(0);
  listView.setSmoothScrollbarEnabled(false);
  onNewIntent(getIntent());
}
 

Example 28

From project android-client_2, under directory /src/org/mifos/androidclient/main/.

Source file: AccountRepaymentScheduleActivity.java

  29 
vote

@Override public void onCreate(Bundle bundle){
  super.onCreate(bundle);
  setContentView(R.layout.repayment_schedule);
  if (bundle != null && bundle.containsKey(RepaymentScheduleItem.BUNDLE_KEY)) {
    mRepaymentScheduleItems=(List<RepaymentScheduleItem>)bundle.getSerializable(RepaymentScheduleItem.BUNDLE_KEY);
  }
  mRepaymentScheduleList=(ListView)findViewById(R.id.repaymentSchedule_list);
  mAccountNumber=getIntent().getStringExtra(AbstractAccountDetails.ACCOUNT_NUMBER_BUNDLE_KEY);
  mAccountService=new AccountService(this);
}
 

Example 29

From project android-context, under directory /defunct/shared/.

Source file: AboutActivity.java

  29 
vote

@Override protected void onListItemClick(ListView l,View v,int position,long id){
  AboutItem item=aboutAdapter.getAboutItem(position);
  final Intent actionIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(item.getAction()));
  try {
    startActivity(actionIntent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.error_email,Toast.LENGTH_LONG).show();
  }
}
 

Example 30

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: ProcessManager.java

  29 
vote

@Override protected void onListItemClick(ListView parent,View view,int position,long id){
  AlertDialog dialog;
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  CharSequence[] options={"Details","Launch"};
  final int index=position;
  builder.setTitle("Process options");
  try {
    builder.setIcon(pk.getApplicationIcon(display_process.get(position).processName));
  }
 catch (  NameNotFoundException e) {
    builder.setIcon(R.drawable.processinfo);
  }
  builder.setItems(options,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int choice){
switch (choice) {
case 0:
        Toast.makeText(ProcessManager.this,display_process.get(index).processName,Toast.LENGTH_SHORT).show();
      break;
case 1:
    Intent i=pk.getLaunchIntentForPackage(display_process.get(index).processName);
  if (i != null)   startActivity(i);
 else   Toast.makeText(ProcessManager.this,"Could not launch",Toast.LENGTH_SHORT).show();
break;
}
}
}
);
dialog=builder.create();
dialog.show();
}
 

Example 31

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

Source file: CardSetsFragment.java

  29 
vote

@Override public void onListItemClick(ListView l,View v,int position,long id){
  CardSet cardSet=mCardSets.get(position);
  if (!cardSet.isRemote() && !cardSet.hasCards()) {
    Toast.makeText(mMainApplication,R.string.view_cards_emtpy_set_message,Toast.LENGTH_SHORT).show();
    return;
  }
  if (cardSet.isRemote()) {
    mProgressBar.setVisibility(ProgressBar.VISIBLE);
    cardSet.setFragmentId(CardSet.CARDS_PAGER_FRAGMENT);
    if (hasConnectivity()) {
      GetExternalCardsTask getExternalCardsTask=new GetExternalCardsTask(cardSet);
      getExternalCardsTask.execute();
    }
 else {
      mProgressBar.setVisibility(ProgressBar.GONE);
      Toast.makeText(mMainApplication,R.string.util_connectivity_error,Toast.LENGTH_SHORT).show();
    }
  }
 else {
    mMainApplication.doAction(ACTION_SHOW_CARDS,cardSet);
  }
}
 

Example 32

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

Source file: AndroidFlashcards.java

  29 
vote

@Override public void onListItemClick(ListView parent,View v,int position,long id){
  Intent i=new Intent(this,LessonSelect.class);
  LessonListItem l=lessons[position];
  if (l.isDir) {
    curDir=l.file;
    parseLessons();
  }
 else {
    i.putExtra("LessonFile",l.file);
    i.putExtra("LessonName",l.name);
    i.putExtra("LessonDesc",l.desc);
    i.putExtra("LessonCount",l.count);
    startActivity(i);
  }
}
 

Example 33

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

Source file: DiffViewFlowExample.java

  29 
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 34

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

Source file: AbstractContactPickerActivity.java

  29 
vote

protected void createCustomPicker(){
  mContactList=(ListView)findViewById(R.id.contactList);
  mcontactFilter=(EditText)findViewById(R.id.contactFilter);
  mcontactFilter.addTextChangedListener(new TextWatcher(){
    public void onTextChanged(    CharSequence s,    int start,    int b,    int c){
    }
    public void beforeTextChanged(    CharSequence s,    int st,    int c,    int a){
    }
    public void afterTextChanged(    Editable s){
      adapter.runQueryOnBackgroundThread(s);
      adapter.getFilter().filter(s.toString());
    }
  }
);
  String[] from=new String[]{col_display_name};
  int[] to=new int[]{android.R.id.text1};
  int layout=android.R.layout.simple_list_item_1;
  adapter=new SimpleCursorAdapter(this,layout,runQuery(null),from,to);
  adapter.setFilterQueryProvider(this);
  mContactList.setAdapter(adapter);
  mContactList.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final CharSequence contactName=((TextView)view.findViewById(android.R.id.text1)).getText();
      choosePhoneNumberAndDial(contactName,String.valueOf(id));
    }
  }
);
}
 

Example 35

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/activity/.

Source file: MovieLibraryActivity.java

  29 
vote

private void initTab(String tabId){
  if (tabId.equals("tab_movies")) {
    mMovieController.onCreate(MovieLibraryActivity.this,mHandler,(ListView)findViewById(R.id.movielist_list));
  }
  if (tabId.equals("tab_actors")) {
    mActorController.onCreate(MovieLibraryActivity.this,mHandler,(ListView)findViewById(R.id.actorlist_list));
  }
  if (tabId.equals("tab_genres")) {
    mGenresController.onCreate(MovieLibraryActivity.this,mHandler,(ListView)findViewById(R.id.genrelist_list));
  }
  if (tabId.equals("tab_files")) {
    mFileController.onCreate(MovieLibraryActivity.this,mHandler,(ListView)findViewById(R.id.filelist_list));
  }
}