Java Code Examples for android.widget.AdapterView.OnItemClickListener

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 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 2

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 3

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

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 4

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: InfoActivity.java

  17 
vote

@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_info);
  final List<InfoItem> list=initList();
  listView.setAdapter(new InfoAdapter(this,list));
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    final AdapterView<?> arg0,    final View arg1,    final int position,    final long arg3){
      handleItemClicked(position);
    }
  }
);
}
 

Example 5

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

Source file: ListFragmentBase.java

  17 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.list_view_layout,container,false);
  mListView=(ListView)view.findViewById(android.R.id.list);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      onListItemClick(mListView,view,position);
    }
  }
);
  return createContentView(view);
}
 

Example 6

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

Source file: AlarmListActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.alarm_list);
  this.getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> view,    View row,    int pos,    long arg3){
      Alarm a=(Alarm)view.getItemAtPosition(pos);
      LogEx.info("Alarm clicked. OperationID: " + a.getOperationId());
      IntentUtil.displayAlarmActivity(AlarmListActivity.this,a);
    }
  }
);
}
 

Example 7

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 8

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

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 9

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

Source file: ItemListFragment.java

  17 
vote

@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  listView=(ListView)view.findViewById(android.R.id.list);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      onListItemClick((ListView)parent,view,position,id);
    }
  }
);
  progressBar=(ProgressBar)view.findViewById(id.pb_loading);
  emptyView=(TextView)view.findViewById(android.R.id.empty);
  configureList(getActivity(),getListView());
}
 

Example 10

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

Source file: CommentEditorActivity.java

  17 
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 11

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

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 12

From project BreizhCamp-android, under directory /src/org/breizhjug/breizhcamp/.

Source file: RoomsActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.rooms);
  Collections.sort(BreizhCampApplication.event.rooms);
  setListAdapter(new RoomListAdapter(this,BreizhCampApplication.event.rooms));
  getListView().setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapter,    View view,    int position,    long id){
      Intent intent=new Intent(RoomsActivity.this,RoomActivity.class);
      intent.putExtra("room",(Room)adapter.getItemAtPosition(position));
      startChildActivity("room",intent);
    }
  }
);
}
 

Example 13

From project Common-Sense-Net-2, under directory /AndroidBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 14

From project cw-omnibus, under directory /external/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 15

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

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 16

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

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 17

From project dreamDroid, under directory /libraries/ABS/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 18

From project examples_2, under directory /SearchView/actionbarsherlock-lib/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 19

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

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 20

From project FileExplorer, under directory /src/net/micode/fileexplorer/.

Source file: FavoriteList.java

  17 
vote

private void setupFavoriteListView(ListView list){
  mListView=list;
  mListView.setAdapter(mFavoriteListAdapter);
  mListView.setLongClickable(true);
  mListView.setOnCreateContextMenuListener(mListViewContextMenuListener);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      onFavoriteListItemClick(parent,view,position,id);
    }
  }
);
}
 

Example 21

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/library/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 22

From project gauges-android, under directory /app/src/main/java/com/github/mobile/gauges/ui/.

Source file: ItemListFragment.java

  17 
vote

@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  listView=(ListView)view.findViewById(android.R.id.list);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      onListItemClick((ListView)parent,view,position,id);
    }
  }
);
  progressBar=(ProgressBar)view.findViewById(id.pb_loading);
  emptyView=(TextView)view.findViewById(android.R.id.empty);
  configureList(getActivity(),getListView());
}
 

Example 23

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/app/.

Source file: ContactListFilterView.java

  17 
vote

@Override protected void onFinishInflate(){
  mFilterList=(ListView)findViewById(R.id.filteredList);
  mFilterList.setTextFilterEnabled(true);
  mFilterList.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Cursor c=(Cursor)mFilterList.getItemAtPosition(position);
      mActivity.mContactListView.startChat(c);
    }
  }
);
}
 

Example 24

From project GnucashMobile, under directory /com_actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 25

From project Google-Tasks-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 26

From project HSR-Timetable, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 27

From project iosched_3, under directory /libprojects/abs/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 28

From project IRC-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 29

From project K6nele, under directory /app/src/ee/ioc/phon/android/speak/.

Source file: RecognizerIntentListActivity.java

  17 
vote

protected void setClickToFinish(final Uri contentUri,final String columnName){
  getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Cursor cursor=(Cursor)parent.getItemAtPosition(position);
      final long key=cursor.getLong(cursor.getColumnIndex(columnName));
      Intent intent=new Intent();
      intent.setData(ContentUris.withAppendedId(contentUri,key));
      setResult(Activity.RESULT_OK,intent);
      finish();
    }
  }
);
}
 

Example 30

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/view/.

Source file: Gallery1.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.gallery_1);
  Gallery g=(Gallery)findViewById(R.id.gallery);
  g.setAdapter(new ImageAdapter(this));
  g.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      Toast.makeText(Gallery1.this,"" + position,Toast.LENGTH_SHORT).show();
    }
  }
);
  registerForContextMenu(g);
}
 

Example 31

From project MensaUPB, under directory /libs/ActionbarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 32

From project motelib, under directory /src/com/cafbit/motelib/settings/.

Source file: AddDeviceActivity.java

  17 
vote

private void createList(){
  setTitle("Select a device type...");
  ListView listView=new ListView(this);
  listView.setAdapter(new DeviceClassListAdapter(this));
  setContentView(listView);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      AddDeviceActivity.this.state.deviceClass=(DeviceClass)parent.getItemAtPosition(position);
      AddDeviceActivity.this.transition(1);
    }
  }
);
}
 

Example 33

From project mWater-Android-App, under directory /android/actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 34

From project MyHeath-Android, under directory /actionbarlib/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 35

From project onebusaway-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 36

From project open311-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsSpinner.java

  17 
vote

public DropdownPopup(Context context,AttributeSet attrs,int defStyleRes){
  super(context,attrs,0,defStyleRes);
  setAnchorView(IcsSpinner.this);
  setModal(true);
  setPromptPosition(POSITION_PROMPT_ABOVE);
  setOnItemClickListener(new OnItemClickListener(){
    @SuppressWarnings("rawtypes") public void onItemClick(    AdapterView parent,    View v,    int position,    long id){
      IcsSpinner.this.setSelection(position);
      dismiss();
    }
  }
);
}
 

Example 37

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

Source file: AASettings.java

  16 
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 38

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

Source file: ListViewActivity.java

  16 
vote

public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.listview_layout);
  ListView listview=(ListView)findViewById(R.id.my_listview);
  ArrayList<HashMap<String,Object>> listitem=new ArrayList<HashMap<String,Object>>();
  for (int i=0; i < 100; i++) {
    HashMap<String,Object> map=new HashMap<String,Object>();
    map.put("itemimage",R.drawable.icon);
    map.put("itemTitle","Item" + i);
    map.put("itemText","Thank you!");
    listitem.add(map);
  }
  SimpleAdapter listitemAdapter=new SimpleAdapter(this,listitem,R.layout.listview_item_layout,new String[]{"itemimage","itemTitle","itemText"},new int[]{R.id.ItemImage,R.id.ItemTitle,R.id.ItemText});
  listview.setAdapter(listitemAdapter);
  listview.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
    }
  }
);
  listview.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
    @Override public void onCreateContextMenu(    ContextMenu menu,    View v,    ContextMenuInfo menuInfo){
      menu.setHeaderTitle("Hello");
      menu.add(0,0,0,"Item One");
      menu.add(0,1,0,"Item Two");
    }
  }
);
}
 

Example 39

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

Source file: WidgetConfigureActivity.java

  16 
vote

public void onResume(){
  super.onResume();
  setContentView(R.layout.main);
  this.setTitle(this.getString(R.string.choose_an_account));
  setResult(RESULT_CANCELED);
  ((View)findViewById(R.id.layMainMenu)).setVisibility(View.GONE);
  Intent intent=getIntent();
  Bundle extras=intent.getExtras();
  if (extras != null) {
    mAppWidgetId=extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  }
  if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
    finish();
  }
  ListView lv=(ListView)findViewById(R.id.lstAccountsList);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (adapter.getItemViewType(position) != AccountsAdapter.VIEWTYPE_ACCOUNT)       return;
      final Context context=WidgetConfigureActivity.this;
      Account account=(Account)parent.getItemAtPosition(position);
      Bank bank=account.getBank();
      WidgetConfigureActivity.setAccountBankId(context,mAppWidgetId,account.getId(),bank.getDbId());
      SharedPreferences.Editor prefs=context.getSharedPreferences("widget_prefs",0).edit();
      prefs.putBoolean("transperant_background" + mAppWidgetId,((CheckBox)findViewById(R.id.chkTransperantBackground)).isChecked());
      prefs.commit();
      AppWidgetManager appWidgetManager=AppWidgetManager.getInstance(context);
      BankdroidWidgetProvider.updateAppWidget(context,appWidgetManager,mAppWidgetId,account);
      Intent resultValue=new Intent();
      resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,mAppWidgetId);
      setResult(RESULT_OK,resultValue);
      finish();
    }
  }
);
  refreshView();
}
 

Example 40

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

Source file: BlueMagicSetEditActivity.java

  16 
vote

@Override public void onStart(){
  super.onStart();
  FFXICharacter charInfo=getFFXICharacter();
{
    BlueMagicSetView ms;
    ms=(BlueMagicSetView)findViewById(R.id.Magics);
    if (ms != null) {
      ms.bindFFXICharacter(charInfo);
      ms.setOnItemClickListener(new OnItemClickListener(){
        public void onItemClick(        AdapterView<?> arg0,        View arg1,        int arg2,        long arg3){
        }
      }
);
      ms.setOnItemLongClickListener(new OnItemLongClickListener(){
        public boolean onItemLongClick(        AdapterView<?> arg0,        View arg1,        int arg2,        long arg3){
          mLongClickingItemPosition=arg2;
          openContextMenu(arg0);
          return true;
        }
      }
);
      registerForContextMenu(ms);
    }
  }
{
    BlueMagicSelectionStatusView bmss;
    bmss=(BlueMagicSelectionStatusView)findViewById(R.id.StatusView);
    if (bmss != null) {
      bmss.bindFFXICharacter(charInfo);
    }
  }
}
 

Example 41

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

Source file: ActionbarFragment.java

  16 
vote

private OnItemClickListener getCardFragmentActionListener(){
  return new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      mListViewOverflow.setVisibility(View.GONE);
switch (position) {
case C_OVERFLOW_ACTION_ZOOM_IN:
        mMainApplication.doAction(ACTION_ZOOM_IN_CARD);
      break;
case C_OVERFLOW_ACTION_ZOOM_OUT:
    mMainApplication.doAction(ACTION_ZOOM_OUT_CARD);
  break;
case C_OVERFLOW_ACTION_CARD_INFO:
mMainApplication.doAction(ACTION_SHOW_CARD_INFO);
break;
case C_OVERFLOW_ACTION_DELETE_CARD:
mMainApplication.doAction(ACTION_DELETE_CARD);
break;
case C_OVERFLOW_ACTION_HELP_CARD:
mMainApplication.doAction(ACTION_SHOW_HELP);
break;
case C_OVERFLOW_ACTION_RESHUFFLE:
mMainApplication.doAction(ACTION_RESHUFFLE_CARDS);
break;
}
}
}
;
}
 

Example 42

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

Source file: MainActivity.java

  16 
vote

@Override protected OnItemClickListener getMenuOnItemClickListener(){
  return new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parentView,    View childView,    int position,    long id){
      Class<?> cls=null;
switch (position) {
case 0:
        cls=HttpGetActivity.class;
      break;
case 1:
    cls=HttpPostActivity.class;
  break;
case 2:
cls=TwitterActivity.class;
break;
case 3:
cls=FacebookActivity.class;
break;
default :
break;
}
startActivity(new Intent(parentView.getContext(),cls));
}
}
;
}
 

Example 43

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

Source file: ViewFlowExample.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  listView=(ListView)findViewById(R.id.menu);
  String[] listeStrings={"Circle indicator...","Title indicator...","Different Views...","Async Data Loading..."};
  listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,listeStrings));
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long arg3){
switch (position) {
case 0:
        startActivity(new Intent(ViewFlowExample.this,CircleViewFlowExample.class));
      break;
case 1:
    startActivity(new Intent(ViewFlowExample.this,TitleViewFlowExample.class));
  break;
case 2:
startActivity(new Intent(ViewFlowExample.this,DiffViewFlowExample.class));
break;
case 3:
startActivity(new Intent(ViewFlowExample.this,AsyncDataFlowExample.class));
break;
}
}
}
);
}
 

Example 44

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

Source file: AbstractContactPickerActivity.java

  16 
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 45

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

Source file: AlbumListController.java

  16 
vote

public void onCreate(Activity activity,Handler handler,AbsListView list){
  mMusicManager=ManagerFactory.getMusicManager(this);
  mControlManager=ManagerFactory.getControlManager(this);
  ((ISortableManager)mMusicManager).setSortKey(AbstractManager.PREF_SORT_KEY_ALBUM);
  ((ISortableManager)mMusicManager).setPreferences(activity.getPreferences(Context.MODE_PRIVATE));
  final String sdError=ImportUtilities.assertSdCard();
  mLoadCovers=sdError == null;
  if (!isCreated()) {
    super.onCreate(activity,handler,list);
    if (!mLoadCovers) {
      Toast toast=Toast.makeText(activity,sdError + " Displaying place holders only.",Toast.LENGTH_LONG);
      toast.show();
    }
    mArtist=(Artist)activity.getIntent().getSerializableExtra(ListController.EXTRA_ARTIST);
    mGenre=(Genre)activity.getIntent().getSerializableExtra(ListController.EXTRA_GENRE);
    activity.registerForContextMenu(mList);
    mFallbackBitmap=BitmapFactory.decodeResource(activity.getResources(),R.drawable.default_album);
    setupIdleListener();
    mList.setOnItemClickListener(new OnItemClickListener(){
      public void onItemClick(      AdapterView<?> parent,      View view,      int position,      long id){
        if (isLoading())         return;
        Intent nextActivity;
        final Album album=(Album)mList.getAdapter().getItem(((ThreeLabelsItemView)view).position);
        nextActivity=new Intent(view.getContext(),ListActivity.class);
        nextActivity.putExtra(ListController.EXTRA_LIST_CONTROLLER,new SongListController());
        nextActivity.putExtra(ListController.EXTRA_ALBUM,album);
        mActivity.startActivity(nextActivity);
      }
    }
);
    mList.setOnKeyListener(new ListControllerOnKeyListener<Album>());
    fetch();
  }
}
 

Example 46

From project AndroidLab, under directory /src/src/de/tubs/ibr/android/ldap/core/activities/.

Source file: ConflictActivity.java

  16 
vote

private void showList(){
  setContentView(R.layout.layout_conflict_list);
  ListView contacts=(ListView)findViewById(android.R.id.list);
  adapter=new SimpleAdapter(this,entryList,R.layout.list_conflict_row,new String[]{"Value1"},new int[]{R.id.value1});
  contacts.setAdapter(adapter);
  contacts.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int row,    long id){
      try {
        Intent i=new Intent(getBaseContext(),ConflictActivity.class);
        @SuppressWarnings("unchecked") HashMap<String,String> listitem=(HashMap<String,String>)arg0.getItemAtPosition(row);
        if (listitem != null) {
          int rawContactId=Integer.parseInt(listitem.get("Value2"));
          i.putExtra("id",rawContactId);
          startActivityForResult(i,0);
        }
      }
 catch (      Exception e) {
      }
    }
  }
);
}
 

Example 47

From project Android_1, under directory /CarouselFragment/src/novoda/demo/.

Source file: Carousel.java

  16 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  super.onCreateView(inflater,container,savedInstanceState);
  Gallery gallery=(Gallery)inflater.inflate(R.layout.carousel_gallery,null);
  gallery.setAdapter(new GalleryAdapter(mContext));
  gallery.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> l,    View v,    int position,    long id){
      count=position;
      ((Carousel)mContext).setSelectedId(id);
      FragmentTransaction ft=getFragmentManager().beginTransaction();
      ft.hide(fragment);
      ft.commit();
    }
  }
);
  gallery.requestFocus();
  gallery.setSelection(mCurCheckPosition);
  return gallery;
}
 

Example 48

From project android_7, under directory /src/org/immopoly/android/fragments/.

Source file: ProfileFragment.java

  16 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  badgeSize=(int)Settings.dp2px(getActivity(),100);
  badgePadding=(int)Settings.dp2px(getActivity(),8);
  GridView gridView=(GridView)getView().findViewById(R.id.gridview);
  final BadgeAdapter badgeAdapter=new BadgeAdapter();
  gridView.setAdapter(badgeAdapter);
  gridView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View view,    int position,    long arg3){
      ImmopolyBadge item=badgeAdapter.getItem(position);
      if (item != null) {
        AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
        View layout=getActivity().getLayoutInflater().inflate(R.layout.badge_dialog,null);
        builder.setView(layout);
        if (view instanceof ImageView) {
          ImageView badgeImage=(ImageView)layout.findViewById(R.id.badgeImage);
          ImageView imageView=(ImageView)view;
          badgeImage.setImageDrawable(imageView.getDrawable());
        }
        mTracker.trackEvent(TrackingManager.CATEGORY_CLICKS,TrackingManager.ACTION_BADGE,TrackingManager.LABEL_VIEW,item.getType());
        ((TextView)layout.findViewById(R.id.badgeText)).setText(item.getText());
        builder.setPositiveButton("Tsch?ss",null);
        builder.create().show();
      }
    }
  }
);
  ((TextView)getView().findViewById(R.id.username)).setText(ImmopolyUser.getInstance().getUserName());
}
 

Example 49

From project andstatus, under directory /src/org/andstatus/app/account/.

Source file: AccountSelector.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  MyPreferences.loadTheme(TAG,this);
  setContentView(R.layout.accountlist);
  ArrayList<Map<String,String>> data=new ArrayList<Map<String,String>>();
  for (int ind=0; ind < MyAccount.list().length; ind++) {
    HashMap<String,String> map=new HashMap<String,String>();
    map.put(KEY_NAME,MyAccount.list()[ind].getAccountGuid());
    map.put(KEY_TYPE,TYPE_ACCOUNT);
    data.add(map);
  }
  ListAdapter adapter=new SimpleAdapter(this,data,R.layout.accountlist_item,new String[]{KEY_NAME,KEY_TYPE},new int[]{R.id.name,R.id.type});
  setListAdapter(adapter);
  getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      String accountName=((TextView)view.findViewById(R.id.name)).getText().toString();
      MyAccount ma=MyAccount.getMyAccount(accountName);
      if (ma.isPersistent()) {
        ma.setCurrentMyAccount();
        AccountSelector.this.setResult(RESULT_OK);
        finish();
      }
    }
  }
);
}
 

Example 50

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: PersonalDeckPicker.java

  16 
vote

/** 
 * Lifecycle methods 
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.download_deck_picker);
  initDownloadManagerService();
  registerExternalStorageListener();
  initDialogs();
  mPersonalDeckDownloads=new ArrayList<Download>();
  mPersonalDecks=new ArrayList<String>();
  mAllPersonalDecks=new ArrayList<Object>();
  mPersonalDecksAdapter=new PersonalDecksAdapter();
  mPersonalDecksListView=(ListView)findViewById(R.id.list);
  mPersonalDecksListView.setAdapter(mPersonalDecksAdapter);
  mPersonalDecksListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      String deckName=(String)mAllPersonalDecks.get(position);
      Download personalDeckDownload=new Download(deckName);
      mPersonalDeckDownloads.add(personalDeckDownload);
      refreshPersonalDecksList();
      try {
        startService(mDownloadManagerServiceIntent);
        mDownloadManagerService.downloadFile(personalDeckDownload);
      }
 catch (      RemoteException e) {
        Log.e(AnkiDroidApp.TAG,"RemoteException = " + e.getMessage());
        e.printStackTrace();
      }
    }
  }
);
  getPersonalDecks();
}
 

Example 51

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

Source file: SelectSecretKeyListActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
  setContentView(R.layout.select_secret_key);
  mList=(ListView)findViewById(R.id.list);
  mList.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      Intent data=new Intent();
      data.putExtra(Apg.EXTRA_KEY_ID,id);
      data.putExtra(Apg.EXTRA_USER_ID,(String)mList.getItemAtPosition(position));
      setResult(RESULT_OK,data);
      finish();
    }
  }
);
  mFilterLayout=findViewById(R.id.layout_filter);
  mFilterInfo=(TextView)mFilterLayout.findViewById(R.id.filterInfo);
  mClearFilterButton=(Button)mFilterLayout.findViewById(R.id.btn_clear);
  mClearFilterButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      handleIntent(new Intent());
    }
  }
);
  handleIntent(getIntent());
}
 

Example 52

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

Source file: ServerListActivity.java

  16 
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 53

From project Barcamp-Bangalore-Android-App, under directory /bcb_app/src/com/bangalore/barcamp/activity/.

Source file: ScheduleActivity.java

  16 
vote

private void addScheduleItems(List<Slot> slotsArray){
  ListView listView=(ListView)findViewById(R.id.listView1);
  adapter=new SlotsListAdapter(this,slotsArray);
  this.slotsArray=slotsArray;
  listView.setAdapter(adapter);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int pos,    long id){
      if (ScheduleActivity.this.slotsArray.get(pos).type.equals(Slot.SESSION)) {
        Intent intent=new Intent(ScheduleActivity.this,SlotDetailsActivity.class);
        intent.putExtra(SlotDetailsActivity.EXTRA_POS,pos);
        startActivity(intent);
      }
    }
  }
);
}
 

Example 54

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

Source file: CategoryFragment.java

  16 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.category,container,false);
  grid=(GridView)view.findViewById(R.id.categoryNewsItemGrid);
  grid.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      NewsItem item=(NewsItem)grid.getAdapter().getItem(position);
      clickHandler.onItemClick(item.getId());
    }
  }
);
  grid.setOnScrollListener(new OnScrollListener(){
    public void onScrollStateChanged(    AbsListView list,    int state){
      if (state == OnScrollListener.SCROLL_STATE_IDLE) {
        int firstVisible=list.getFirstVisiblePosition();
        int lastVisible=list.getLastVisiblePosition();
        for (int i=firstVisible; i <= lastVisible; i++) {
          NewsItem item=(NewsItem)list.getAdapter().getItem(i);
          if (item.getThumbnailBytes() == null) {
            Bundle bundle=new Bundle();
            bundle.putInt(ResourceService.KEY_ITEM_ID,item.getId());
            service.sendMessageToService(ResourceService.MSG_LOAD_THUMB,bundle);
          }
        }
      }
    }
    public void onScroll(    AbsListView list,    int firstVisible,    int visibleItems,    int totalItems){
    }
  }
);
  return view;
}
 

Example 55

From project BF3-Battlelog, under directory /src/com/ninetwozero/battlelog/activity/forum/.

Source file: ForumThreadFragment.java

  16 
vote

public Dialog generateDialogLinkList(final Context context,final List<String> links){
  final AlertDialog.Builder builder=new AlertDialog.Builder(context);
  final LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final View layout=inflater.inflate(R.layout.dialog_thread_link,(ViewGroup)getActivity().findViewById(R.id.dialog_root));
  builder.setTitle(R.string.info_forum_link_title);
  builder.setNegativeButton(android.R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
);
  final AlertDialog theDialog=builder.create();
  theDialog.setView(layout,0,0,0,0);
  ListView listView=(ListView)layout.findViewById(R.id.list_links);
  listView.setAdapter(new ArrayAdapter<String>(context,R.layout.list_item_plain,android.R.id.text1,links));
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      String currentLink=links.get(arg2);
      new AsyncLinkHandling(context).execute(currentLink,mSharedPreferences.getString(Constants.SP_BL_PROFILE_CHECKSUM,""));
      theDialog.dismiss();
    }
  }
);
  return theDialog;
}
 

Example 56

From project BombusLime, under directory /src/org/bombusim/lime/activity/.

Source file: LoggerActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.log);
  logListView=(ListView)findViewById(R.id.loggerListView);
  logListView.setAdapter(new LogListAdapter(this));
  logListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View v,    int position,    long id){
      ListView l=(ListView)arg0;
      ((LogListAdapter)l.getAdapter()).toggle(position);
    }
  }
);
  loggerEnabled=(CheckBox)findViewById(R.id.loggerEnable);
  loggerEnabled.setChecked(LimeLog.getLocalXmlEnabled());
  loggerEnabled.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      LimeLog.setlocalXmlEnabled(isChecked);
    }
  }
);
  noAutoscroll=(CheckBox)findViewById(R.id.loggerFreeze);
  noAutoscroll.setChecked(disableAutoScroll);
  noAutoscroll.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      disableAutoScroll=isChecked;
    }
  }
);
}
 

Example 57

From project bookmarktodesktop-android-application, under directory /src/be/vbsteven/bmtodesk/.

Source file: MainActivity.java

  16 
vote

private void initIncomingBookmarks(){
  bookmarkStore=BookmarkStore.get(this);
  incomingListView=(ListView)findViewById(R.id.content_lv);
  incomingListView.setAdapter(new IncomingBookmarkAdapter(this,bookmarkStore.getLatestIncomingBookmarks()));
  incomingListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      IncomingBookmark clickedBm=(IncomingBookmark)arg0.getItemAtPosition(arg2);
      Intent i=new Intent(Intent.ACTION_VIEW);
      i.setData(Uri.parse(clickedBm.url));
      i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(i);
    }
  }
);
}
 

Example 58

From project ChkBugReport, under directory /examples/testapp/src/com/sonymobile/chkbugreport/testapp/.

Source file: MainActivity.java

  16 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mListView=new ListView(this);
  mListView.setAdapter(new BaseAdapter(){
    @Override public View getView(    int position,    View convertView,    ViewGroup parent){
      if (convertView == null) {
        LayoutInflater li=LayoutInflater.from(MainActivity.this);
        convertView=li.inflate(android.R.layout.simple_list_item_1,parent,false);
      }
      TextView tv=(TextView)convertView.findViewById(android.R.id.text1);
      Class<?> cls=TESTS[position];
      tv.setText(cls.getSimpleName());
      convertView.setTag(cls);
      return convertView;
    }
    @Override public long getItemId(    int position){
      return position;
    }
    @Override public Object getItem(    int position){
      return TESTS[position];
    }
    @Override public int getCount(){
      return TESTS.length;
    }
  }
);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Class<?> cls=(Class<?>)view.getTag();
      Intent intent=new Intent(MainActivity.this,cls);
      startActivity(intent);
    }
  }
);
  setContentView(mListView);
}
 

Example 59

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

Source file: PubkeyListActivity.java

  16 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.act_pubkeylist);
  this.setTitle(String.format("%s: %s",getResources().getText(R.string.app_name),getResources().getText(R.string.title_pubkey_list)));
  pubkeydb=new PubkeyDatabase(this);
  updateList();
  registerForContextMenu(getListView());
  getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> adapter,    View view,    int position,    long id){
      PubkeyBean pubkey=(PubkeyBean)getListView().getItemAtPosition(position);
      boolean loaded=bound.isKeyLoaded(pubkey.getNickname());
      if (loaded) {
        bound.removeKey(pubkey.getNickname());
        updateHandler.sendEmptyMessage(-1);
      }
 else {
        handleAddKey(pubkey);
      }
    }
  }
);
  clipboard=(ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
  inflater=LayoutInflater.from(this);
}
 

Example 60

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

Source file: aboutActivity.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  fillInfotoVector();
  aboutAdapter=new aboutAdapter(aboutActivity.this,info);
  setListAdapter(aboutAdapter);
  ListView list=getListView();
  list.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> arg0,    View arg1,    int position,    long arg3){
switch (position) {
case LICENSE:
        Intent licenseIntent=new Intent(aboutActivity.this,LicenseActivity.class);
      startActivity(licenseIntent);
    break;
case EMAIL:
  Intent emailIntent=new Intent(android.content.Intent.ACTION_SEND);
String EmailValue[]={"[email protected]"};
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,EmailValue);
emailIntent.putExtra(android.content.Intent.EXTRA_CC,"");
emailIntent.putExtra(android.content.Intent.EXTRA_BCC,"");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,"");
startActivity(emailIntent);
break;
case WEBSITE:
Uri uriUrl=Uri.parse("http://odaym.github.com/Cura/");
Intent launchBrowser=new Intent(Intent.ACTION_VIEW,uriUrl);
startActivity(launchBrowser);
break;
}
}
}
);
}
 

Example 61

From project devoxx-france-android-in-fine, under directory /src/com/infine/android/devoxx/ui/.

Source file: SessionDetailFragment.java

  16 
vote

/** 
 * Build and add "summary" tab.
 */
private void setupSpeakersTab(){
  mTabHost.addTab(mTabHost.newTabSpec(TAG_SPEAKERS).setIndicator(buildIndicator(R.string.session_speakers)).setContent(R.id.tab_session_speakers));
  mListView=(ListView)mRootView.findViewById(R.id.tab_session_speakers);
  mListView.setClickable(true);
  mListView.setAdapter(mAdapter);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> list,    View view,    int position,    long id){
      final Cursor cursor=(Cursor)mAdapter.getItem(position);
      final String speakerId=cursor.getString(SpeakersQuery.SPEAKER_ID);
      final Uri speakerUri=ScheduleContract.Speakers.buildSpeakerUri(speakerId);
      final Intent intent=new Intent(Intent.ACTION_VIEW,speakerUri);
      ((BaseActivity)getActivity()).openActivityOrFragment(intent);
    }
  }
);
}
 

Example 62

From project Diktofon, under directory /app/src/kaljurand_at_gmail_dot_com/diktofon/activity/.

Source file: RecordingListActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mPrefs=PreferenceManager.getDefaultSharedPreferences(getBaseContext());
  Dirs.setBaseDir(getPackageName());
  MyFileUtils.createNomedia();
  loadRecordingsInBackground();
  mListView=getListView();
  mListView.setFastScrollEnabled(true);
  GuiUtils.setEmptyView(this,mListView,getString(R.string.emptyview_recordings));
  GuiUtils.setDivider(mListView);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Recording note=(Recording)mListView.getItemAtPosition(position);
      viewTrans(note);
    }
  }
);
  handleIntent(getIntent());
  registerForContextMenu(mListView);
}
 

Example 63

From project droidtv, under directory /src/com/chrulri/droidtv/.

Source file: ChannelsActivity.java

  16 
vote

private void onCreateImpl(){
  setContentView(R.layout.channels);
  mSpinner=(Spinner)findViewById(R.id.spinner);
  mSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      loadChannels((String)parent.getSelectedItem());
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
      loadChannels(null);
    }
  }
);
  mListView=(ListView)findViewById(R.id.listView);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      watchChannel((int)id);
    }
  }
);
  loadChannelLists();
  setChannelList(null);
  if (mSpinner.getAdapter().getCount() == 0) {
    PreferenceUtils.openSettings(this);
  }
}
 

Example 64

From project E12Planner, under directory /src/com/neoware/europlanner/.

Source file: TeamsActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.teams_layout);
  BitmapDrawable bg=(BitmapDrawable)getResources().getDrawable(R.drawable.toolbar_bg);
  bg.setTileModeXY(TileMode.REPEAT,TileMode.REPEAT);
  ActionBar bar=getSupportActionBar();
  bar.setBackgroundDrawable(bg);
  bar.setTitle(R.string.teams_title);
  bar.setHomeButtonEnabled(true);
  bar.setDisplayHomeAsUpEnabled(true);
  bar.setDisplayUseLogoEnabled(true);
  final String teams[]=getResources().getStringArray(R.array.team_names);
  final String groups[]=getResources().getStringArray(R.array.groups);
  ListView teamsListView=(ListView)findViewById(R.id.teamsListView);
  teamsListView.setAdapter(new TeamsAdapter(teams,groups));
  teamsListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      RowTag tag=(RowTag)view.getTag();
      if (tag.isTeam) {
        Intent squadIntent=new Intent(TeamsActivity.this,SquadActivity.class);
        squadIntent.putExtra(SquadActivity.TEAM_INDEX,tag.teamID);
        startActivity(squadIntent);
      }
 else       if (tag.isHeader) {
        Intent gamesIntent=new Intent(TeamsActivity.this,GamesActivity.class);
        gamesIntent.putExtra(GamesActivity.GROUP_KNOCKOUT,tag.groupID);
        startActivity(gamesIntent);
      }
    }
  }
);
}
 

Example 65

From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/ui/base/.

Source file: TwitterListBaseActivity.java

  16 
vote

protected void registerOnClickListener(ListView listView){
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Tweet tweet=getContextItemTweet(position);
      if (tweet == null) {
        Log.w(TAG,"Selected item not available.");
        specialItemClicked(position);
      }
 else {
        launchActivity(StatusActivity.createIntent(tweet));
      }
    }
  }
);
}
 

Example 66

From project FlickrCity, under directory /src/com/FlickrCity/FlickrCityAndroid/Activities/.

Source file: CityDetailsView.java

  16 
vote

private void showFlickrPhotos(){
  GridView gridview=(GridView)findViewById(R.id.picture_grid_view);
  final List<FlickrPhoto> photosURLs=api.call(mLat,mLng);
  imageAdapter=new ImageAdapter(this,photosURLs);
  gridview.setAdapter(imageAdapter);
  urls_list=new ArrayList<String>();
  for (int i=0; i < photosURLs.size(); i++)   urls_list.add(photosURLs.get(i).getPhototURL('s'));
  gridview.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View v,    int position,    long id){
      ImageView theView=(ImageView)v.findViewById(R.id.image);
      String data=(String)theView.getContentDescription();
      String lines[]=data.split("\\r?\\n");
      String oldUrl=lines[0];
      int lastChar=oldUrl.length() - 6;
      String oldSubUrl=oldUrl.substring(0,lastChar);
      String newUrl=oldSubUrl + ".jpg";
      long flickrPhotoID=Long.parseLong(lines[1]);
      String owner=lines[2];
      String title="";
      if (lines.length > 3)       title=lines[3];
      FlickrAPI flickrAPI=new FlickrAPI();
      String username=flickrAPI.getUserName(owner,CityDetailsView.this);
      Intent i=new Intent(mContext,PhotoActivity.class);
      i.putExtra(Constants.URL_KEY,newUrl);
      i.putExtra(Constants.USERNAME_KEY,username);
      i.putExtra(Constants.TITLE_KEY,title);
      i.putExtra(Constants.PHOTO_ID_KEY,Long.toString(flickrPhotoID));
      i.putExtra(Constants.URLS_LIST_KEY,urls_list);
      i.putExtra(Constants.CURRENT_POSITION,position);
      i.putExtra(Constants.CITY_NAME_KEY,mCity);
      i.putExtra(Constants.CITY_GEO_INFO_KEY,geoTextInfo);
      startActivity(i);
    }
  }
);
}
 

Example 67

From project gh4a, under directory /src/com/gh4a/.

Source file: BlogListActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  setTheme(Gh4Application.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.generic_list);
  ActionBar actionBar=getSupportActionBar();
  actionBar.setTitle(R.string.blog);
  actionBar.setSubtitle(R.string.explore);
  actionBar.setDisplayHomeAsUpEnabled(true);
  mListView=(ListView)findViewById(R.id.list_view);
  CommonFeedAdapter adapter=new CommonFeedAdapter(this,new ArrayList<Feed>());
  mListView.setAdapter(adapter);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      Feed blog=(Feed)adapterView.getAdapter().getItem(position);
      Intent intent=new Intent().setClass(BlogListActivity.this,BlogActivity.class);
      intent.putExtra(Constants.Blog.TITLE,blog.getTitle());
      intent.putExtra(Constants.Blog.CONTENT,blog.getContent());
      intent.putExtra(Constants.Blog.LINK,blog.getLink());
      startActivity(intent);
    }
  }
);
  new LoadBlogsTask(this).execute();
}
 

Example 68

From project GradeCalculator-Android, under directory /GradeCalculator/src/com/jetheis/android/grades/activity/.

Source file: CourseListActivity.java

  16 
vote

public void refreshCourseList(){
  Log.v(Constants.TAG,"Refreshing course list");
  mCourses=Course.getAllCourses();
  mCourseArrayAdapter=new CourseArrayAdapter(this,mCourses);
  mListFragment.setListAdapter(mCourseArrayAdapter);
  mListFragment.getListView().setOnItemLongClickListener(new OnItemLongClickListener(){
    @Override public boolean onItemLongClick(    AdapterView<?> parent,    View view,    int position,    long id){
      mListFragment.getListView().setItemChecked(position,true);
      mCurrentlySelectedCourse=mCourseArrayAdapter.getItem(position);
      startActionMode(mCourseSelectionCallback);
      return true;
    }
  }
);
  mListFragment.getListView().setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Intent courseIntent=new Intent(CourseListActivity.this,CourseActivity.class);
      courseIntent.putExtra(CourseActivity.INTENT_KEY_COURSE,mCourseArrayAdapter.getItem(position));
      startActivity(courseIntent);
    }
  }
);
  Log.v(Constants.TAG,mCourses.size() + " courses loaded from the database");
}
 

Example 69

From project greenhouse-android, under directory /src/com/springsource/greenhouse/events/.

Source file: EventDetailsActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.event_details);
  final ListView listView=(ListView)findViewById(R.id.event_details_menu);
  String[] menu_items=getResources().getStringArray(R.array.event_details_options_array);
  ArrayAdapter<String> arrayAdapter=new ArrayAdapter<String>(this,R.layout.menu_list_item,menu_items);
  listView.setAdapter(arrayAdapter);
  listView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Intent intent=new Intent();
switch (position) {
case 0:
        intent.setClass(view.getContext(),EventSessionsFilteredActivity.class);
      break;
case 1:
    intent.setClass(view.getContext(),EventSessionsScheduleActivity.class);
  break;
case 2:
intent.setClass(view.getContext(),PostTweetActivity.class);
break;
case 3:
intent.setClass(view.getContext(),EventTweetsActivity.class);
break;
default :
break;
}
startActivity(intent);
}
}
);
}
 

Example 70

From project hsDroid, under directory /src/de/nware/app/hsDroid/ui/.

Source file: Certifications.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  checkSession();
  setContentView(R.layout.certifications);
  customTitle(getString(R.string.title_Certifications));
  defaultDLPath=Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_DOWNLOADS;
  mPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  listView=(ListView)findViewById(R.id.cert_listView);
  final ContentResolver resolver=getContentResolver();
  Cursor cursor=resolver.query(CertificationsCol.CONTENT_URI,null,null,null,null);
  startManagingCursor(cursor);
  final String[] from=new String[]{CertificationsCol.TITLE};
  final int[] to=new int[]{R.id.cert_textView};
  listView.setAdapter(new SimpleCursorAdapter(getApplicationContext(),R.layout.certifications_row_item,cursor,from,to));
  findViewById(R.id.certificationsProgress).setVisibility(View.GONE);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (isSdCardAvailable()) {
        view.showContextMenu();
      }
    }
  }
);
  listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
    @Override public void onCreateContextMenu(    ContextMenu menu,    View view,    ContextMenuInfo menuInfo){
      menu.setHeaderTitle(R.string.title_certContextMenu_selectAction);
      getMenuInflater().inflate(R.menu.cert_menu,menu);
    }
  }
);
}
 

Example 71

From project iohack, under directory /src/org/alljoyn/bus/sample/chat/.

Source file: ViewChannelActivity.java

  16 
vote

public void onCreate(Bundle savedInstanceState){
  Log.i(TAG,"onCreate()");
  super.onCreate(savedInstanceState);
  setContentView(R.layout.viewchannel);
  final Activity self=this;
  mChatApplication=(ChatApplication)getApplication();
  mChatApplication.checkin();
  ArrayAdapter<String> channelListAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1);
  final ListView channelList=(ListView)findViewById(R.id.useJoinChannelList);
  channelList.setAdapter(channelListAdapter);
  channelList.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View v,    int arg2,    long arg3){
      String str=((TextView)v).getText().toString();
      mChatApplication.useSetChannelName(str);
      mChatApplication.useJoinChannel();
      Intent i=new Intent(self,UseActivity.class);
      self.startActivity(i);
    }
  }
);
  List<String> channels=mChatApplication.getFoundChannels();
  for (  String channel : channels) {
    int lastDot=channel.lastIndexOf('.');
    if (lastDot < 0) {
      continue;
    }
    channelListAdapter.add(channel.substring(lastDot + 1));
  }
  channelListAdapter.notifyDataSetChanged();
  mChatApplication.addObserver(this);
}
 

Example 72

From project k-9, under directory /src/com/fsck/k9/activity/.

Source file: FolderList.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mActionBarProgressView=getLayoutInflater().inflate(R.layout.actionbar_indeterminate_progress_actionview,null);
  mActionBar=getSupportActionBar();
  initializeActionBar();
  setContentView(R.layout.folder_list);
  mListView=getListView();
  mListView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
  mListView.setLongClickable(true);
  mListView.setFastScrollEnabled(true);
  mListView.setScrollingCacheEnabled(false);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      onOpenFolder(((FolderInfoHolder)mAdapter.getItem(position)).name);
    }
  }
);
  registerForContextMenu(mListView);
  mListView.setSaveEnabled(true);
  mInflater=getLayoutInflater();
  onNewIntent(getIntent());
  context=this;
}
 

Example 73

From project keepassdroid, under directory /src/com/keepassdroid/.

Source file: IconPickerActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.icon_picker);
  GridView currIconGridView=(GridView)findViewById(R.id.IconGridView);
  currIconGridView.setAdapter(new ImageAdapter(this));
  currIconGridView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View v,    int position,    long id){
      final Intent intent=new Intent();
      intent.putExtra(KEY_ICON_ID,position);
      setResult(EntryEditActivity.RESULT_OK_ICON_PICKER,intent);
      finish();
    }
  }
);
}
 

Example 74

From project KeyboardTerm, under directory /src/tw/kenshinn/keyboardTerm/.

Source file: AddressBookActivity.java

  16 
vote

@Override public void onResume(){
  super.onResume();
  if (dbUtils == null)   dbUtils=new DBUtils(this);
  prefs=PreferenceManager.getDefaultSharedPreferences(this);
  if (!prefs.getBoolean("INITIALIZED",false)) {
    initHost();
    initFunctionBtns();
    Editor editor=prefs.edit();
    editor.putBoolean("INITIALIZED",true);
    editor.commit();
    AlertDialog.Builder builder=new AlertDialog.Builder(AddressBookActivity.this);
    builder.setMessage(R.string.initial_message);
    builder.setPositiveButton("OK",null);
    builder.show();
  }
  this.getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Host host=getRealHost(position);
      Log.i(TAG,host.getHost());
      connect(host);
    }
  }
);
  this.registerForContextMenu(this.getListView());
  update();
}
 

Example 75

From project lastfm-android, under directory /app/src/fm/last/android/activity/.

Source file: AddToPlaylist.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.add_to_playlist);
  mNewPlaylist=(EditText)findViewById(R.id.new_playlist);
  mNewPlaylist.setOnKeyListener(new View.OnKeyListener(){
    public boolean onKey(    View v,    int keyCode,    KeyEvent event){
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_ENTER:
        mCreateBtn.performClick();
      return true;
default :
    return false;
}
}
}
);
mCreateBtn=(Button)findViewById(R.id.create_button);
mCreateBtn.setOnClickListener(new OnClickListener(){
public void onClick(View v){
if (mNewPlaylist.getText().length() > 0) {
  new CreatePlaylistTask(mNewPlaylist.getText().toString()).execute((Void)null);
}
}
}
);
mPlaylistsList=(ListView)findViewById(R.id.playlists);
mPlaylistsList.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> l,View v,int position,long id){
ListAdapter adapter=(ListAdapter)mPlaylistsList.getAdapter();
adapter.enableLoadBar(position);
RadioPlayList playlist=(RadioPlayList)adapter.getItem(position);
String artist=getIntent().getStringExtra(INTENT_EXTRA_ARTIST);
String track=getIntent().getStringExtra(INTENT_EXTRA_TRACK);
new AddToPlaylistTask(artist,track,playlist.getId()).execute((Void)null);
}
}
);
new LoadPlaylistsTask().execute((Void)null);
}
 

Example 76

From project LitHub, under directory /LitHub-Android/src/us/lithub/ui/activity/.

Source file: Lending.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_lending);
  mDatabase=new UserDb(this);
  mDatabase.open();
  mCursor=mDatabase.getAllTransactions();
  TransactionAdapter adapter=new TransactionAdapter(this,mCursor);
  mListView=(ListView)findViewById(R.id.lvListView);
  mListView.setAdapter(adapter);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      Toast.makeText(Lending.this,"onItemClick()",Toast.LENGTH_SHORT).show();
    }
  }
);
}
 

Example 77

From project LoL-Chat, under directory /src/com/rei/lolchat/ui/.

Source file: ChangeStatus.java

  16 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case CATEGORY_ID:
    AlertDialog.Builder builder;
  Context mContext=this;
LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout=inflater.inflate(R.layout.icon_select,(ViewGroup)findViewById(R.id.layout_root));
gridView=(GridView)layout.findViewById(R.id.profile_icon);
gridView.setAdapter(new ImageAdapter(this));
gridView.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView parent,View v,int position,long id){
dialog.dismiss();
profileIcon=position;
Editor edit=mSettings.edit();
edit.putInt(BeemApplication.PROFILE_KEY,position);
edit.commit();
mAvatar.setImageDrawable(getResources().getDrawable(BeemApplication.PROFILEIDS[profileIcon]));
refreshStatusXml();
}
}
);
ImageView close=(ImageView)layout.findViewById(R.id.close);
close.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
dialog.dismiss();
}
}
);
builder=new AlertDialog.Builder(mContext);
builder.setView(layout);
dialog=builder.create();
break;
default :
dialog=null;
}
return dialog;
}
 

Example 78

From project LunaTerm, under directory /src/tw/loli/lunaTerm/.

Source file: AddressBookActivity.java

  16 
vote

@Override public void onResume(){
  super.onResume();
  if (dbUtils == null)   dbUtils=new DBUtils(this);
  prefs=PreferenceManager.getDefaultSharedPreferences(this);
  if (!prefs.getBoolean("INITIALIZED",false)) {
    initHost();
    initFunctionBtns();
    Editor editor=prefs.edit();
    editor.putBoolean("INITIALIZED",true);
    editor.commit();
  }
  this.getListView().setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Host host=getRealHost(position);
      Log.i(TAG,host.getHost());
      connect(host);
    }
  }
);
  this.registerForContextMenu(this.getListView());
  update();
}
 

Example 79

From project madvertise-android-sdk, under directory /examples/simple/src/de/madvertise/test/.

Source file: BannerActivity.java

  16 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  MadvertiseView.setAge("20-26");
  MadvertiseView.setGender(MadvertiseView.GENDER_FEMALE);
  setContentView(R.layout.main);
  mMadView=(MadvertiseView)findViewById(R.id.madad);
  mMadView.setMadvertiseViewCallbackListener(this);
  String[] countries=new String[]{"French Southern Territories","Gabon","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Heard Island and McDonald Islands","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Kuwait","Kyrgyzstan","Laos"};
  ListAdapter adapter=new ArrayAdapter<String>(this,R.layout.list_item,countries);
  ListView listView=(ListView)findViewById(R.id.country_list);
  listView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Toast.makeText(getApplicationContext(),((TextView)view).getText(),Toast.LENGTH_SHORT).show();
    }
  }
);
  listView.setAdapter(adapter);
  mTracker=MadvertiseTracker.getInstance(this);
  mTracker.reportLaunch();
}
 

Example 80

From project MIT-Mobile-for-Android, under directory /src/edu/mit/mitmobile2/emergency/.

Source file: EmergencyContactsActivity.java

  16 
vote

private void updateView(){
  mLoadingView.setVisibility(View.GONE);
  ListView listView=(ListView)findViewById(R.id.emergencyListView);
  listView.setVisibility(View.VISIBLE);
  final EmergencyDB db=EmergencyDB.getInstance(this);
  EmergencyContactsAdapter adapter=new EmergencyContactsAdapter(this,db.getContactsCursor());
  listView.setAdapter(adapter);
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Contact c=db.getContact(position);
      String numericPhone=PhoneNumberUtils.convertKeypadLettersToDigits(c.phone);
      Intent intent=new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + numericPhone));
      startActivity(intent);
    }
  }
);
}
 

Example 81

From project mobilis, under directory /DemoApps/ChatSessionTransfer/src/de/tudresden/inf/rn/mobilis/migration/chat/activities/.

Source file: ContactsActivity.java

  16 
vote

private void initContacts(){
  try {
    mOwnUsername=MXAController.get().getXMPPService().getUsername().split("/")[0];
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
  mCursorContacts=getContentResolver().query(RosterItems.CONTENT_URI,null,RosterItems.PRESENCE_MODE + "<>\"" + RosterItems.MODE_UNAVAILABLE+ "\" AND "+ RosterItems.XMPP_ID+ "<>\""+ mOwnUsername+ "\") GROUP BY ("+ RosterItems.XMPP_ID,null,RosterItems.XMPP_ID + " ASC");
  startManagingCursor(mCursorContacts);
  ContactsAdapter adapter=new ContactsAdapter(this,R.layout.contacts_item,mCursorContacts,new String[]{RosterItems.NAME,RosterItems.PRESENCE_MODE,RosterItems.UPDATED_DATE,RosterItems.PRESENCE_STATUS,RosterItems.XMPP_ID},new int[]{R.id.contacts_item_name,R.id.roster_item_image});
  mLstContacts.setAdapter(adapter);
  mLstContacts.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> l,    View v,    int position,    long id){
      String xmppid=mCursorContacts.getString(mCursorContacts.getColumnIndex(ConstMXA.RosterItems.XMPP_ID));
      String res=mCursorContacts.getString(mCursorContacts.getColumnIndex(ConstMXA.RosterItems.RESSOURCE));
      Intent i=new Intent(Const.ACTION_SEND);
      i.putExtra(Const.EXTRA_XMPP_ID,xmppid);
      startActivity(i);
    }
  }
);
}
 

Example 82

From project NFC-Contact-Exchanger, under directory /src/com/tonchidot/nfc_contact_exchanger/.

Source file: ContacterMainActivity.java

  16 
vote

private void setUpHistory(){
  Calendar past=Calendar.getInstance();
  past.add(Calendar.MINUTE,-10);
  Cursor cursor=managedQuery(ContactsProvider.CONTENT_URI,null,ContactsProvider.KEY_DATE + ">" + past.getTimeInMillis(),null,ContactsProvider.KEY_DATE + " DESC");
  List<Contact> history=new ArrayList<Contact>();
  while (cursor.moveToNext()) {
    history.add(Contact.createFromCursor(cursor));
  }
  final HistoryAdapter adapter=new HistoryAdapter(this,history);
  ListView historyList=(ListView)findViewById(R.id.list_contacts);
  historyList.setAdapter(adapter);
  historyList.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      Contact entry=(Contact)adapter.getItem(position);
      Intent intent=new Intent(ContacterMainActivity.this,ContactReceivedActivity.class);
      intent.putExtra(ContactReceivedActivity.EXTRA_HISTORY_ID,entry.id);
      startActivity(intent);
    }
  }
);
  historyList.setOnItemLongClickListener(HistoryActivity.createHistoryLongClickListener(this,adapter));
  getContentResolver().registerContentObserver(ContactsProvider.CONTENT_URI,true,changedHandler);
}
 

Example 83

From project NFCShopping, under directory /mobile phone client/NFCShopping/src/scut/bgooo/ui/.

Source file: DiscountItemListActivity.java

  16 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.discountitemlist);
  mProgress=findViewById(R.id.progress2);
  Bundle bundle=getIntent().getBundleExtra("ID");
  int id=Integer.valueOf(bundle.getString("ID"));
  HashMap<String,Integer> map=new HashMap<String,Integer>();
  map.put("ID",id);
  Task task=new Task(Task.GET_DISCOUNTITEM,map);
  TaskHandler.allActivity.put(DiscountItemListActivity.class.getSimpleName(),this);
  TaskHandler.addTask(task);
  mListView=(ListView)findViewById(R.id.privilege_listview);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      Intent intent=new Intent(DiscountItemListActivity.this,ProductActivity.class);
      intent.putExtra("product",(Product)discountitem.get(arg2).getProperty(6));
      startActivity(intent);
    }
  }
);
}
 

Example 84

From project official-android-app--DEPRECATED-, under directory /src/com/plancake/android/app/activity/.

Source file: TagsActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.tags);
  this.dbAdapter=new DbAdapter(this);
  this.dbAdapter.open();
  ListView tagsSetView=(ListView)findViewById(R.id.tagsSet);
  tags=new ArrayList<PlancakeTag>();
  Cursor tagsCursor=this.dbAdapter.getAllTags();
  PlancakeTag tag;
  if (tagsCursor.moveToFirst()) {
    do {
      tag=new PlancakeTag(tagsCursor.getInt(DbAdapter.DATABASE_COLUMN_TAG_ID_INDEX),tagsCursor.getString(DbAdapter.DATABASE_COLUMN_TAG_NAME_INDEX),tagsCursor.getInt(DbAdapter.DATABASE_COLUMN_TAG_SORT_ORDER_INDEX));
      tags.add(tag);
    }
 while (tagsCursor.moveToNext());
  }
  if (tagsCursor != null) {
    tagsCursor.close();
  }
  final TagItemAdapter tia;
  tia=new TagItemAdapter(this,R.layout.tag_item,tags);
  tagsSetView.setAdapter(tia);
  tagsSetView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView _av,    View _v,    int _index,    long arg3){
      selectedTag=tags.get(_index);
      Intent getTasksIntent=new Intent(TagsActivity.this,TasksActivity.class);
      getTasksIntent.putExtra("tagId",selectedTag.id);
      startActivity(getTasksIntent);
    }
  }
);
}
 

Example 85

From project ohmagePhone, under directory /src/org/ohmage/prompt/multichoice/.

Source file: MultiChoicePrompt.java

  16 
vote

@Override public View getView(Context context){
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  ListView listView=(ListView)inflater.inflate(R.layout.prompt_multi_choice,null);
  listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
  String[] from=new String[]{"value"};
  int[] to=new int[]{android.R.id.text1};
  List<HashMap<String,String>> data=new ArrayList<HashMap<String,String>>();
  for (int i=0; i < mChoices.size(); i++) {
    HashMap<String,String> map=new HashMap<String,String>();
    map.put("key",mChoices.get(i).key);
    map.put("value",mChoices.get(i).label);
    data.add(map);
  }
  SimpleAdapter adapter=new SimpleAdapter(context,data,R.layout.multi_choice_list_item,from,to);
  adapter.setViewBinder(new ViewBinder(){
    @Override public boolean setViewValue(    View view,    Object data,    String textRepresentation){
      ((CheckedTextView)view).setText((String)data);
      return true;
    }
  }
);
  listView.setAdapter(adapter);
  if (mSelectedIndexes.size() > 0) {
    for (    int index : mSelectedIndexes) {
      if (index >= 0 && index < mChoices.size())       listView.setItemChecked(index,true);
    }
  }
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (((ListView)parent).isItemChecked(position)) {
        mSelectedIndexes.add(Integer.valueOf(position));
      }
 else {
        mSelectedIndexes.remove(Integer.valueOf(position));
      }
    }
  }
);
  return listView;
}
 

Example 86

From project Ohmage_Phone, under directory /src/org/ohmage/prompt/multichoice/.

Source file: MultiChoicePrompt.java

  16 
vote

@Override public View getView(Context context){
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  ListView listView=(ListView)inflater.inflate(R.layout.prompt_multi_choice,null);
  listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
  String[] from=new String[]{"value"};
  int[] to=new int[]{android.R.id.text1};
  List<HashMap<String,String>> data=new ArrayList<HashMap<String,String>>();
  for (int i=0; i < mChoices.size(); i++) {
    HashMap<String,String> map=new HashMap<String,String>();
    map.put("key",mChoices.get(i).key);
    map.put("value",mChoices.get(i).label);
    data.add(map);
  }
  SimpleAdapter adapter=new SimpleAdapter(context,data,R.layout.multi_choice_list_item,from,to);
  adapter.setViewBinder(new ViewBinder(){
    @Override public boolean setViewValue(    View view,    Object data,    String textRepresentation){
      ((CheckedTextView)view).setText((String)data);
      return true;
    }
  }
);
  listView.setAdapter(adapter);
  if (mSelectedIndexes.size() > 0) {
    for (    int index : mSelectedIndexes) {
      if (index >= 0 && index < mChoices.size())       listView.setItemChecked(index,true);
    }
  }
  listView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (((ListView)parent).isItemChecked(position)) {
        mSelectedIndexes.add(Integer.valueOf(position));
      }
 else {
        mSelectedIndexes.remove(Integer.valueOf(position));
      }
    }
  }
);
  return listView;
}
 

Example 87

From project OpenBike, under directory /src/fr/openbike/android/ui/.

Source file: OpenBikeListActivity.java

  16 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.list_layout);
  if (Intent.ACTION_VIEW.equals(getIntent().getAction())) {
    showStationDetails(getIntent().getData());
    finish();
  }
  mReceiver=DetachableResultReceiver.getInstance(new Handler());
  mActivityHelper=new ActivityHelper(this);
  mActivityHelper.setupActionBar(getString(R.string.station_list));
  mListView=getListView();
  mSharedPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      showStationDetails(String.valueOf((Integer)((OpenBikeArrayAdaptor.ViewHolder)view.getTag()).favorite.getTag()));
    }
  }
);
  registerForContextMenu(mListView);
  mDBAdapter=OpenBikeDBAdapter.getInstance(this);
  startService(new Intent(this,LocationService.class));
}
 

Example 88

From project pandoroid, under directory /src/com/aregner/android/pandoid/.

Source file: PandoidStationSelect.java

  16 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  pandora=PandoraRadioService.getInstance(true);
  ArrayList<Station> stations=pandora.getStations();
  ListView lv=getListView();
  setListAdapter(new StationListAdapter(stations,this));
  lv.setTextFilterEnabled(true);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      setResult(RESULT_OK,(new Intent()).putExtra("stationId",id));
      finish();
    }
  }
);
}
 

Example 89

From project PennMeet, under directory /src/com/pennapps/pennmeet/.

Source file: BumpActivity.java

  16 
vote

public void setupGroupList(){
  groupListView=(ListView)findViewById(R.id.group_list);
  testGroup=new Group("1234981234","Penn Electric Racing","N/A","[email protected]",null,"Michael Cera","William Henry",getResources().getDrawable(R.drawable.per));
  testGroup2=new Group("1234123432","PennApps","N/A","[email protected]",null,"Pulak Mittal","Alexey Komissarouk",getResources().getDrawable(R.drawable.pennapps));
  testGroup3=new Group("0713049371","Extreme Chess Club","We rock at Chess.","[email protected]",null,"Vladimir Belikov","Utut Adianto",getResources().getDrawable(R.drawable.chess));
  testGroup4=new Group("1206721212","Penn Model Congress","Hold annual high school conferences for model congress events","[email protected]",null,"Robert Robertson","Andrew Stephenson",getResources().getDrawable(R.drawable.pennmc));
  testGroup5=new Group("9612403397","Muse","N/A","[email protected]",null,"Jon Hunstman","Donny Trump",getResources().getDrawable(R.drawable.muse));
  groupList=new ArrayList<Group>();
  groupAdapter=new GroupAdapter(this,R.layout.groups_list_item,groupList);
  groupListView.setAdapter(groupAdapter);
  groupListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      sendingGroup=((TextView)((ViewGroup)((ViewGroup)arg1).getChildAt(1)).getChildAt(0)).getText().toString();
      bump();
      mFlipper.setDisplayedChild(2);
    }
  }
);
}
 

Example 90

From project PinDroid, under directory /src/com/pindroid/fragment/.

Source file: BrowseNotesFragment.java

  16 
vote

@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  mAdapter=new SimpleCursorAdapter(this.getActivity(),R.layout.note_view,null,new String[]{Note.Title},new int[]{R.id.note_title},0);
  setListAdapter(mAdapter);
  getLoaderManager().initLoader(0,null,this);
  final ListView lv=getListView();
  lv.setTextFilterEnabled(true);
  lv.setFastScrollEnabled(true);
  lv.setItemsCanFocus(false);
  lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final Cursor c=(Cursor)lv.getItemAtPosition(position);
      Note n=NoteManager.CursorToNote(c);
      viewNote(n);
    }
  }
);
}
 

Example 91

From project Pixelesque, under directory /src/com/rj/pixelesque/.

Source file: ArtListFragment.java

  16 
vote

@Override public void onStart(){
  super.onStart();
  gridview=(GridView)getView().findViewById(R.id.list);
  gridview.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> arg0,    View arg1,    int arg2,    long arg3){
      if (listener != null) {
        listener.onArtItemSelected(adapter.getItem(arg2));
      }
    }
  }
);
  adapter=new ArtAdapter(getActivity(),0);
  gridview.setAdapter(adapter);
  new ImageListLoader().execute();
}
 

Example 92

From project platform_frameworks_ex, under directory /chips/src/com/android/ex/chips/.

Source file: RecipientEditTextView.java

  16 
vote

public RecipientEditTextView(Context context,AttributeSet attrs){
  super(context,attrs);
  if (sSelectedTextColor == -1) {
    sSelectedTextColor=context.getResources().getColor(android.R.color.white);
  }
  mAlternatesPopup=new ListPopupWindow(context);
  mAlternatesPopup.setOnDismissListener(this);
  mAddressPopup=new ListPopupWindow(context);
  mAddressPopup.setOnDismissListener(this);
  mCopyDialog=new Dialog(context);
  mAlternatesListener=new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long rowId){
      mAlternatesPopup.setOnItemClickListener(null);
      setEnabled(true);
      replaceChip(mSelectedChip,((RecipientAlternatesAdapter)adapterView.getAdapter()).getRecipientEntry(position));
      Message delayed=Message.obtain(mHandler,DISMISS);
      delayed.obj=mAlternatesPopup;
      mHandler.sendMessageDelayed(delayed,DISMISS_DELAY);
      clearComposingText();
    }
  }
;
  setInputType(getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
  setOnItemClickListener(this);
  setCustomSelectionActionModeCallback(this);
  mHandler=new Handler(){
    @Override public void handleMessage(    Message msg){
      if (msg.what == DISMISS) {
        ((ListPopupWindow)msg.obj).dismiss();
        return;
      }
      super.handleMessage(msg);
    }
  }
;
  mTextWatcher=new RecipientTextWatcher();
  addTextChangedListener(mTextWatcher);
  mGestureDetector=new GestureDetector(context,this);
}
 

Example 93

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/group/.

Source file: GroupBrowseListFragment.java

  16 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  if (savedInstanceState != null) {
    mSelectedGroupUri=savedInstanceState.getParcelable(EXTRA_KEY_GROUP_URI);
    if (mSelectedGroupUri != null) {
      mSelectionToScreenRequested=true;
    }
  }
  mRootView=inflater.inflate(R.layout.group_browse_list_fragment,null);
  mEmptyView=(TextView)mRootView.findViewById(R.id.empty);
  mAdapter=new GroupBrowseListAdapter(mContext);
  mAdapter.setSelectionVisible(mSelectionVisible);
  mAdapter.setSelectedGroup(mSelectedGroupUri);
  mListView=(AutoScrollListView)mRootView.findViewById(R.id.list);
  mListView.setOnFocusChangeListener(this);
  mListView.setOnTouchListener(this);
  mListView.setAdapter(mAdapter);
  mListView.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      GroupListItemViewCache groupListItem=(GroupListItemViewCache)view.getTag();
      if (groupListItem != null) {
        viewGroup(groupListItem.getUri());
      }
    }
  }
);
  mListView.setEmptyView(mEmptyView);
  mAddAccountsView=mRootView.findViewById(R.id.add_accounts);
  mAddAccountButton=mRootView.findViewById(R.id.add_account_button);
  mAddAccountButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent(Settings.ACTION_ADD_ACCOUNT);
      intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
      intent.putExtra(Settings.EXTRA_AUTHORITIES,new String[]{ContactsContract.AUTHORITY});
      startActivity(intent);
    }
  }
);
  setAddAccountsVisibility(!ContactsUtils.areGroupWritableAccountsAvailable(mContext));
  return mRootView;
}
 

Example 94

From project platform_packages_apps_im, under directory /src/com/android/im/app/.

Source file: ContactListFilterView.java

  16 
vote

@Override protected void onFinishInflate(){
  mContactListView=(ListView)findViewById(R.id.filteredList);
  mContactListView.setTextFilterEnabled(true);
  mContactListView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView parent,    View view,    int position,    long id){
      if (mContext instanceof ContactListActivity) {
        ContactListActivity list=(ContactListActivity)mContext;
        mContactListView.setSelection(position);
        Cursor c=(Cursor)mContactListView.getSelectedItem();
        list.mContactListView.startChat(c);
        list.showContactListView();
      }
    }
  }
);
}
 

Example 95

From project androidquery, under directory /src/com/androidquery/.

Source file: AbstractAQuery.java

  15 
vote

/** 
 * Register a callback method for when an item is clicked in the ListView.
 * @param listener The callback method.
 * @return self
 */
public T itemClicked(OnItemClickListener listener){
  if (view instanceof AdapterView) {
    AdapterView<?> alv=(AdapterView<?>)view;
    alv.setOnItemClickListener(listener);
  }
  return self();
}
 

Example 96

From project OpenComm, under directory /UICode/UIFirstRN/src/com/opencomm/uifirst/.

Source file: Login.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  Button login=(Button)findViewById(R.id.login);
  login.setOnClickListener(new OnClickListener(){
    public void onClick(    View viewParam){
      EditText usernameEditText=(EditText)findViewById(R.id.entry_user);
      EditText passwordEditText=(EditText)findViewById(R.id.entry_pwd);
      String sUserName=usernameEditText.getText().toString();
      String sPassword=passwordEditText.getText().toString();
      if (sUserName.equals("") || sPassword.equals("")) {
        Toast.makeText(Login.this,"Both Username and Password required!",Toast.LENGTH_SHORT).show();
      }
 else       if (sUserName.equals("opencomm") && sPassword.equals("bailey2010")) {
        Toast.makeText(Login.this,"Welcome, " + sUserName,Toast.LENGTH_SHORT).show();
        setContentView(R.layout.buddy);
        GridView gridview=(GridView)findViewById(R.id.buddygrid);
        gridview.setAdapter(new ImageAdapter(Login.this));
        gridview.setOnItemClickListener(new OnItemClickListener(){
          public void onItemClick(          AdapterView<?> parent,          View v,          int position,          long id){
            Toast.makeText(Login.this,"" + position,Toast.LENGTH_SHORT).show();
          }
        }
);
      }
 else {
        Toast.makeText(Login.this,"Username and password not valid.",Toast.LENGTH_SHORT).show();
      }
    }
  }
);
}
 

Example 97

From project PageTurner, under directory /src/main/java/net/nightwhistler/pageturner/activity/.

Source file: LibraryActivity.java

  15 
vote

@Override protected void onPostExecute(QueryResult<LibraryBook> result){
  bookAdapter.setResult(result);
  if (result instanceof KeyedQueryResult && result.getSize() >= ALPHABET_THRESHOLD) {
    final KeyedQueryResult<LibraryBook> keyedResult=(KeyedQueryResult<LibraryBook>)result;
    alphabetAdapter=new AlphabetAdapter(LibraryActivity.this,R.layout.alphabet_line,R.id.alphabetLabel,keyedResult.getAlphabet());
    alphabetBar.setAdapter(alphabetAdapter);
    alphabetBar.setOnItemClickListener(new AdapterView.OnItemClickListener(){
      @Override public void onItemClick(      AdapterView<?> arg0,      View arg1,      int arg2,      long arg3){
        Character c=keyedResult.getAlphabet().get(arg2);
        onAlphabetBarClick(keyedResult,c);
      }
    }
);
    setAlphabetBarVisible(true);
  }
 else {
    alphabetAdapter=null;
    setAlphabetBarVisible(false);
  }
  waitDialog.hide();
  if (sel == Configuration.LibrarySelection.LAST_ADDED && result.getSize() == 0 && !askedUserToImport) {
    askedUserToImport=true;
    buildImportQuestionDialog();
    importQuestion.show();
  }
}