Java Code Examples for android.widget.AdapterView

The following are top voted examples for showing how to use android.widget.AdapterView. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Toodoo   File: ToodooNote.java   Source Code and License 7 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.label_dialog);
    labelList = (ListView) findViewById(R.id.label_list);
    cancel = (Button) findViewById(R.id.cancel);
    // ListView
    SimpleAdapter adapter = new SimpleAdapter(context, getLabelList(),
            R.layout.label_list_item, new String[]{"label_img",
            "label_value"}, new int[]{
            R.id.label_img, R.id.label_value});
    labelList.setAdapter(adapter);
    //ListView
    labelList
            .setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> arg0, View arg1,
                                        int position, long arg3) {
                    HashMap<String, Object> label = getLabelList().get(position);
                    selectedLabel = (String) label.get("label_value");

                    ToodooOptionsModel ToodooOptionsModel = toodooOptionsList.get(0);
                    ToodooOptionsModel.setOptionValue(selectedLabel);
                    mAdapter.notifyDataSetChanged();
                    labelDialog.dismiss();
                }
            });

    cancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            labelDialog.dismiss();
        }
    });
}
 
Example 2
Project: YiZhi   File: FriendListPage.java   Source Code and License 6 votes vote down vote up
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
	if ("FacebookMessenger".equals(platform.getName())) {
		if(lastPosition >= 0) {
			Following lastFollwing = adapter.getItem(lastPosition);
			lastFollwing.checked = false;
		}
		lastPosition = position;
	}
	Following following = adapter.getItem(position);
	following.checked = !following.checked;

	if(following.checked) {
		checkNum++;
	} else {
		checkNum--;
	}

	updateConfirmView();
	adapter.notifyDataSetChanged();
}
 
Example 3
Project: PeSanKita-android   File: DeviceListFragment.java   Source Code and License 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  final String deviceName = ((DeviceListItem)view).getDeviceName();
  final long   deviceId   = ((DeviceListItem)view).getDeviceId();

  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  builder.setTitle(getActivity().getString(R.string.DeviceListActivity_unlink_s, deviceName));
  builder.setMessage(R.string.DeviceListActivity_by_unlinking_this_device_it_will_no_longer_be_able_to_send_or_receive);
  builder.setNegativeButton(android.R.string.cancel, null);
  builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      handleDisconnectDevice(deviceId);
    }
  });
  builder.show();
}
 
Example 4
Project: time-weather   File: ChooseAreaFragment.java   Source Code and License 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    if (currentLevel == LEVEL_PROVINCE) {
        selectedProvince = provinceList.get(position);
        queryCities();
    }
    else if (currentLevel == LEVEL_CITY) {
        selectedCity = cityList.get(position);
        queryCounties();
    }
    else if (currentLevel == LEVEL_COUNTY) {
        String weatherID = countyList.get(position).getWeatherID();
        Intent intent = new Intent(getActivity(), WeatherActivity.class);

        intent.putExtra("weather_id", weatherID);
        startActivity(intent);
        getActivity().finish();
    }
}
 
Example 5
Project: MultipleRvView   File: MainActivity.java   Source Code and License 6 votes vote down vote up
private void lvClick() {

        lv_main.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

                switch (i) {
                    case 0:
                        startOtherActivity(LinearLayoutActivity.class);
                        break;
                    case 1:
                        startOtherActivity(GridActivity.class);
                        break;
                    case 2:
                        startOtherActivity(FlowLayoutActivity.class);
                        break;



                }
            }
        });
    }
 
Example 6
Project: cniao5   File: FriendListPage.java   Source Code and License 6 votes vote down vote up
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
	if ("FacebookMessenger".equals(platform.getName())) {
		if(lastPosition >= 0) {
			Following lastFollwing = adapter.getItem(lastPosition);
			lastFollwing.checked = false;
		}
		lastPosition = position;
	}
	Following following = adapter.getItem(position);
	following.checked = !following.checked;

	if(following.checked) {
		checkNum++;
	} else {
		checkNum--;
	}

	updateConfirmView();
	adapter.notifyDataSetChanged();
}
 
Example 7
Project: CCDownload   File: UploadFragment.java   Source Code and License 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
	UploadView uploadView = (UploadView)view;
	String uploadId = uploadView.getUploadId();
	if (binder.isStop()) {
		UploadInfo uploadInfo = DataSet.getUploadInfo(uploadId);
		if (uploadInfo != null && uploadInfo.getStatus() != Uploader.FINISH) {
			startUploadService(uploadInfo);
		}
		
		currentUploadId = uploadId;
		
	} else if (uploadId.equals(currentUploadId)) {
		
		switch (binder.getUploaderStatus()) {
		case Uploader.UPLOAD:
			binder.pause();
			break;
		case Uploader.PAUSE:
			binder.upload();
			break;
		}
	}
}
 
Example 8
Project: dex-hdog   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    ListView listView = (ListView) parent;
    AppInfo appInfo = (AppInfo) listView.getItemAtPosition(position);
    String packageName = appInfo.getPackageName();
    String appName = appInfo.getAppName();
    Log.d(TAG, packageName);
    if(!JniUtil.isRunning(packageName)){
        openApp(packageName);
    }

    Log.d(TAG, "Create folder:" + FileUtil.createPath(HDOG_PATH +File.separator + packageName + File.separator + TYPE_DEX));
    Log.d(TAG, "Create folder:" + FileUtil.createPath(HDOG_PATH +File.separator + packageName + File.separator + TYPE_DEY));

    Intent intent = new Intent(this, DumpActivity.class);
    intent.putExtra("package_name", packageName);
    intent.putExtra("app_name", appName);
    startActivity(intent);
}
 
Example 9
Project: SciChart.Android.Examples   File: HomeActivity.java   Source Code and License 6 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (module == null) return;
    final List<Example> examples = module.getExamples();
    final String category = getCategoryByPosition(selectedPosition);
    final List<Example> exampleItems = convertToAdapterItems(examples, category);
    switch (position) {
        case 0:
            adapter.setSortStrategy(new SortByCategory(exampleItems));
            break;
        case 1:
            adapter.setSortStrategy(new SortByFeatures(exampleItems));
            break;
        case 2:
            adapter.setSortStrategy(new SortByName(exampleItems));
            break;
        case 3:
            adapter.setSortStrategy(new SortByMostUsed(exampleItems));
            break;
    }
}
 
Example 10
Project: sctalk   File: ChatFragment.java   Source Code and License 6 votes vote down vote up
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
        int position, long id) {

    RecentInfo recentInfo = contactAdapter.getItem(position);
    if (recentInfo == null) {
        logger.e("recent#onItemLongClick null recentInfo -> position:%d", position);
        return false;
    }
    if (recentInfo.getSessionType() == DBConstant.SESSION_TYPE_SINGLE) {
        handleContactItemLongClick(getActivity(),recentInfo);
    } else {
        handleGroupItemLongClick(getActivity(),recentInfo);
    }
    return true;
}
 
Example 11
Project: lqrwechatrongcloud   File: FriendListPage.java   Source Code and License 6 votes vote down vote up
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
	if ("FacebookMessenger".equals(platform.getName())) {
		if(lastPosition >= 0) {
			Following lastFollwing = adapter.getItem(lastPosition);
			lastFollwing.checked = false;
		}
		lastPosition = position;
	}
	Following following = adapter.getItem(position);
	following.checked = !following.checked;

	if(following.checked) {
		checkNum++;
	} else {
		checkNum--;
	}

	updateConfirmView();
	adapter.notifyDataSetChanged();
}
 
Example 12
Project: buildAPKsSamples   File: DeviceListActivity.java   Source Code and License 6 votes vote down vote up
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) {
    // Cancel discovery because it's costly and we're about to connect
    mBtAdapter.cancelDiscovery();

    // Get the device MAC address, which is the last 17 chars in the View
    String info = ((TextView) v).getText().toString();
    String address = info.substring(info.length() - 17);

    // Create the result Intent and include the MAC address
    Intent intent = new Intent();
    intent.putExtra(EXTRA_DEVICE_ADDRESS, address);

    // Set result and finish this Activity
    setResult(Activity.RESULT_OK, intent);
    finish();
}
 
Example 13
Project: GitHub   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (position){
        case 1:
            startActivity(new Intent(this, BannerAnimationActivity.class));
            break;
        case 2:
            startActivity(new Intent(this, BannerStyleActivity.class));
            break;
        case 3:
            startActivity(new Intent(this, IndicatorPositionActivity.class));
            break;
        case 4:
            startActivity(new Intent(this, CustomBannerActivity.class));
            break;
        case 5:
            startActivity(new Intent(this, BannerLocalActivity.class));
            break;
        case 6:
            startActivity(new Intent(this, CustomViewPagerActivity.class));
            break;
    }
}
 
Example 14
Project: buildAPKsApps   File: MediaPicker.java   Source Code and License 6 votes vote down vote up
private View newList(
    final PickerQuery q, final ViewAnimator flip,
    AdapterView.OnItemClickListener click) {
  final View list = newList(q, click);
  list.setOnKeyListener(new View.OnKeyListener() {
      @Override
      public boolean onKey(View v, int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK &&
            event.getAction() == KeyEvent.ACTION_UP) {
          flip.setInAnimation(getContext(), R.anim.slide_in_left);
          flip.setOutAnimation(getContext(), R.anim.slide_out_right);
          flip.showPrevious();
          flip.removeView(list);
          flip.setInAnimation(getContext(), R.anim.slide_in_right);
          flip.setOutAnimation(getContext(), R.anim.slide_out_left);
          return true;
        }
        return false;
      }
    });
  return list;
}
 
Example 15
Project: Shared-Route   File: TaskViewActivity.java   Source Code and License 6 votes vote down vote up
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    listItemList = trollyAdapter.getItems();
    FlipShareView shareBottom = new FlipShareView.Builder(this, mToolbar)
            .addItem(new ShareItem("发布者::"+listItemList.get(position).PublisherName, Color.WHITE, 0xff43549C))
            .addItem(new ShareItem("联系方式:"+listItemList.get(position).PublisherName, Color.WHITE, 0xff43549C))
            .addItem(new ShareItem("物品类型:"+listItemList.get(position).TaskKindID, Color.WHITE, 0xff43549C))
            .addItem(new ShareItem("物品描述:"+listItemList.get(position).Remark, Color.WHITE, 0xff4999F0))
            .addItem(new ShareItem("取件时间:"+listItemList.get(position).FetchTime, Color.WHITE, 0xffD9392D))
            .addItem(new ShareItem("取件地点:"+listItemList.get(position).FetchLocation, Color.WHITE, 0xff57708A))
            .addItem(new ShareItem("送件时间:"+listItemList.get(position).SendTime, Color.WHITE, 0xffea0bb2))
            .addItem(new ShareItem("送件地点:"+listItemList.get(position).SendLocation, Color.WHITE, 0xffea650b))
            .addItem(new ShareItem("订单价格:"+listItemList.get(position).Money, Color.WHITE,0xff063e04))
            .setItemDuration(200)
            .setBackgroundColor(0x60000000)
            .setAnimType(FlipShareView.TYPE_SLIDE)
            .create();
    return true;
}
 
Example 16
Project: CXJPadProject   File: VoucherFragment.java   Source Code and License 6 votes vote down vote up
public void initListPop() {
    listPopupWindow = new ListPopupWindow(getContext());
    ListPopAdapter listPopAdapter = new ListPopAdapter(getContext(), valueList);
    listPopupWindow.setAdapter(listPopAdapter);
    listPopupWindow.setWidth(RelativeLayout.LayoutParams.WRAP_CONTENT);
    listPopupWindow.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT);
    listPopupWindow.setAnchorView(tv_select_coupons);
    listPopupWindow.setModal(true);
    listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            tv_select_coupons.setText(valueList.get(position));
            mKey = cardTemplateList.get(position).key;
            listPopupWindow.dismiss();
        }
    });
}
 
Example 17
Project: couch-potatoes   File: PictureGridActivity.java   Source Code and License 6 votes vote down vote up
private void addChangeProfilePicListener( final DBHelper dbHelper, final String uid ) {
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            pos = position;

            new AlertDialog.Builder(PictureGridActivity.this)
                    .setTitle("Use as profile picture?")
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            StorageReference storageRef = dbHelper.getStorage().getReference("Photo/" + uid + "/" + hashList.get(pos));
                            storageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                                @Override
                                public void onSuccess(Uri downloadUrl) {
                                    dbHelper.getDb().getReference(dbHelper.getUserPath()).child(uid).child("profile_pic").setValue(downloadUrl.toString());
                                    finish();
                                }
                            });
                        }
                    })
                    .setNegativeButton(android.R.string.no, null).show();
        }
    });
}
 
Example 18
Project: GitHub   File: DropboxStyleActivity.java   Source Code and License 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (Item.values()[position]) {
        case 默认主题:
            setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark);
            mRefreshLayout.setPrimaryColors(0xff283645, 0xff6ea9ff);
            break;
        case 蓝色主题:
            setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark);
            break;
        case 绿色主题:
            setThemeColor(android.R.color.holo_green_light, android.R.color.holo_green_dark);
            break;
        case 红色主题:
            setThemeColor(android.R.color.holo_red_light, android.R.color.holo_red_dark);
            break;
        case 橙色主题:
            setThemeColor(android.R.color.holo_orange_light, android.R.color.holo_orange_dark);
            break;
    }
    mRefreshLayout.autoRefresh();
}
 
Example 19
Project: GitHub   File: DemoActivity.java   Source Code and License 6 votes vote down vote up
@Override
public void initEvent() {//必须在onCreate方法内调用
	//示例代码<<<<<<<<<<<<<<<<<<<

	lvDemo.setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			setResult(RESULT_OK, new Intent().putExtra(RESULT_CLICKED_ITEM, position));
			finish();
		}
	});

	//分页滚动示例代码<<<<<<<<<<<<<<<<<<<
	new PageScroller(lvDemo).init();
	//分页滚动示例代码>>>>>>>>>>>>>>>>>>>

	//示例代码>>>>>>>>>>>>>>>>>>>
}
 
Example 20
Project: aos-Video   File: BrowserWithShowHeader.java   Source Code and License 6 votes vote down vote up
protected void applySelectedViewMode(int newMode) {
    if(mHeaderView!=null) { //removing headerview
        if (mArchosGridView instanceof ListView) {
            ((ListView) mArchosGridView).removeHeaderView(mHeaderView);
            ((AdapterView)mHeaderView.getParent()).removeViewInLayout(mHeaderView);
        }
        if(mArchosGridView instanceof HeaderGridView)
            ((HeaderGridView) mArchosGridView).removeHeaderView(mHeaderView);

    }
    // Save the current position variables before changing the view mode
    setPosition();
    mSelectedPosition = mArchosGridView.getFirstVisiblePosition();
    setViewMode(newMode);
    //replacing headerView

        addHeaderView();
    bindAdapter();

}
 
Example 21
Project: LearnHangul   File: CharactersActivity.java   Source Code and License 6 votes vote down vote up
private void setCharacterList(){

        ListView character_list = (ListView) findViewById(R.id.character_list);
        final ArrayAdapter<Character> adapter = new RowAdapter(this,characters);
        character_list.setAdapter(adapter);

        character_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

                boolean isSelected = characters.get(i).isActive() ? false : true;
                characters.get(i).setActive(isSelected);
                adapter.notifyDataSetChanged();

            }
        });

    }
 
Example 22
Project: DialogHelper   File: ShareDialog.java   Source Code and License 6 votes vote down vote up
@Override
public void initData() {

    list = new ArrayList<>();
    list.add(context.getString(R.string.weChat));
    list.add(context.getString(R.string.qq));
    list.add(context.getString(R.string.weChatFriends));
    list.add(context.getString(R.string.qzone));
    list.add(context.getString(R.string.sina));

    gridView.setAdapter(new ShareAdapter(context, list));

    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            if (onItemClick != null) {
                onItemClick.onItemClick(i);
            }

        }
    });
}
 
Example 23
Project: decoy   File: ContactsFragment.java   Source Code and License 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
                        long id) {
    AbsContactItem item = (AbsContactItem) adapter.getItem(position);
    if (item == null) {
        return;
    }

    int type = item.getItemType();

    if (type == ItemTypes.FUNC && customization != null) {
        customization.onFuncItemClick(item);
        return;
    }

    if (type == ItemTypes.FRIEND && item instanceof ContactItem && NimUIKit.getContactEventListener() != null) {
        NimUIKit.getContactEventListener().onItemClick(getActivity(), (((ContactItem) item).getContact()).getContactId());
    }
}
 
Example 24
Project: Rey-MusicPlayer   File: EqualizerActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int index, long arg3) {
    PreferencesHelper.getInstance().put(PreferencesHelper.Key.LAST_PRESET_NAME, mReverbSpinner.getSelectedItem().toString());
    reverbSetting = index;

    if (mApp.isServiceRunning())
        if (index == 0) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_NONE);
            reverbSetting = 0;
        } else if (index == 1) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_LARGEHALL);
            reverbSetting = 1;
        } else if (index == 2) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_LARGEROOM);
            reverbSetting = 2;
        } else if (index == 3) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_MEDIUMHALL);
            reverbSetting = 3;
        } else if (index == 4) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_MEDIUMROOM);
            reverbSetting = 4;
        } else if (index == 5) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_SMALLROOM);
            reverbSetting = 5;
        } else if (index == 6) {
            mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_PLATE);
            reverbSetting = 6;
        } else
            reverbSetting = 0;
}
 
Example 25
Project: FilterPlayer   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) {

    glSurfaceView.queueEvent(new Runnable() {
        @Override public void run() {
            // notify the renderer that we want to change the encoder's state
            videoRenderer.changeFilterMode(position);
        }
    });
}
 
Example 26
Project: android_ui   File: BaseSamplesNavigationFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(@NonNull AdapterView<?> parent, @NonNull View view, int position, long id) {
	final SampleItem item = getAdapter().getItem(position);
	mFragmentController.newRequest((int) item.getId())
			.addToBackStack(true)
			.execute();
}
 
Example 27
Project: GravityBox   File: OngoingNotifPreference.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    IIconCheckListAdapterItem item = 
            (IIconCheckListAdapterItem) parent.getItemAtPosition(position);
    item.setChecked(!item.isChecked());
    mListView.invalidateViews();
}
 
Example 28
Project: Earthquake-App   File: EarthquakeActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_earthquake);
    init();

    //TODO: verify if there's internet connection

        if(thereIsInternet()){
            progressBar.setVisibility(View.VISIBLE);
        }
        else if(!(thereIsInternet())){
            progressBar.setVisibility(View.GONE);
            noInternetConection.setText("There is no internet connection");
        }
    // Find a reference to the {@link ListView} in the layout
    LoaderManager loaderManager = getLoaderManager();
    loaderManager.initLoader(EARTHQUAKE_LOADER, null, this);

    //TODO: set up the correct url
    earthquakeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Earthquake earthquake = earthquakeAdapterm.getItem(i);
            intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(earthquake.getUrl()));
            startActivity(intent);
        }
    });
}
 
Example 29
Project: container   File: ResolverActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    final int checkedPos = mListView.getCheckedItemPosition();
    final boolean hasValidSelection = checkedPos != ListView.INVALID_POSITION;
    if (mAlwaysUseOption && (!hasValidSelection || mLastSelected != checkedPos)) {
        mAlwaysButton.setEnabled(hasValidSelection);
        mOnceButton.setEnabled(hasValidSelection);
        if (hasValidSelection) {
            mListView.smoothScrollToPosition(checkedPos);
        }
        mLastSelected = checkedPos;
    } else {
        startSelected(position, false);
    }
}
 
Example 30
Project: FireFiles   File: StandaloneActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (mIgnoreNextNavigation) {
        mIgnoreNextNavigation = false;
        return;
    }
    while (mState.stack.size() > position + 1) {
        mState.stackTouched = true;
        mState.stack.pop();
    }
    onCurrentDirectoryChanged(ANIM_UP);
}
 
Example 31
Project: Make-A-Pede-Android-App   File: DeviceListActivity.java   Source Code and License 5 votes vote down vote up
protected void onListItemClick(AdapterView l, View v, int position, long id) {
	final BluetoothDevice device = leDeviceListAdapter.getDevice(position);

	if (device == null) return;

	final Intent intent = new Intent(this, ControllerActivity.class);
	intent.putExtra(EXTRAS_DEVICE_NAME, device.getName());
	intent.putExtra(EXTRAS_DEVICE_ADDRESS, device.getAddress());
	intent.putExtra(EXTRAS_DEVICE_TYPE, device.getType());

	btScanner.stopScan();

	startActivity(intent);
}
 
Example 32
Project: SmartRefreshLayout   File: RefreshUsingFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Item item = Item.values()[position];
    if (Activity.class.isAssignableFrom(item.clazz)) {
        startActivity(new Intent(getContext(), item.clazz));
    } else if (Fragment.class.isAssignableFrom(item.clazz)) {
        FragmentActivity.start(this, item.clazz);
    }
}
 
Example 33
Project: DoorAccess   File: LocationFragment.java   Source Code and License 5 votes vote down vote up
@Override
public boolean onContextItemSelected(MenuItem menuItem) {

    final AdapterView.AdapterContextMenuInfo menuInfo;
    menuInfo = (AdapterView.AdapterContextMenuInfo)menuItem.getMenuInfo();

    /**
     * menuInfo.position for List index
     * menuItem.getItemId for operation index
     */
    ReaderLocation rLocation = mRLocaitonList.get(menuInfo.position);
    switch(menuItem.getItemId()) {
        case LOC_CONTEXT_MENU_MODIFY:
            Toast.makeText(getContext(), "LOC_CONTEXT_MENU_MODIFY", Toast.LENGTH_SHORT);
            ModifyLocationFragment modifyLocationFragment = new ModifyLocationFragment(rLocation, menuInfo.position);
            modifyLocationFragment.setTargetFragment(this, 0);
            modifyLocationFragment.show(mFragmentManager, "ModifyLocation");
            break;
        case LOC_CONTEXT_MENU_TAG:
            Toast.makeText(getContext(), "LOC_CONTEXT_MENU_TAG", Toast.LENGTH_SHORT);
            AssociateTagFragment associateTagFragment = new AssociateTagFragment(rLocation, menuInfo.position);
            associateTagFragment.setTargetFragment(this, 0);
            associateTagFragment.show(mFragmentManager, "AssociateTag");
            break;
        case LOC_CONTEXT_MENU_DELETE:
            Toast.makeText(getContext(), "LOC_CONTEXT_MENU_DELETE", Toast.LENGTH_SHORT);
            DeleteLocation(rLocation);
            break;
    }

    return false;
}
 
Example 34
Project: boohee_v5.6   File: StatusPostTextActivity.java   Source Code and License 5 votes vote down vote up
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    if ("add".equals((String) StatusPostTextActivity.this.mAdapter.getItem(position))) {
        StatusPostTextActivity.this.openPhotoPicker();
        return;
    }
    StatusPostTextActivity.this.mCurEditPicPosition = position;
    Uri imageUri = Uri.fromFile(new File((String) StatusPostTextActivity.this
            .mSelectPictures.get(position)));
    Intent intent = new Intent(StatusPostTextActivity.this.mActivity, ImageEditActivity
            .class);
    intent.setData(imageUri);
    StatusPostTextActivity.this.startActivityForResult(intent, 4);
}
 
Example 35
Project: boohee_v5.6   File: MeasureCurveActivity.java   Source Code and License 5 votes vote down vote up
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long arg3) {
    MeasureCurveActivity.this.setSpinnerText(view);
    MeasureCurveActivity.this.measureType = MeasureCurveActivity.this.getMeasureType
            (position);
    MeasureCurveActivity.this.mMeasure.clear();
    MeasureCurveActivity.this.mCurrentDate = DateHelper.format(new Date());
    MeasureCurveActivity.this.mEndDate = MeasureCurveActivity.this.mCurrentDate;
    MeasureCurveActivity.this.mBeginDate = MeasureCurveActivity.this.getDateByMode
            (MeasureCurveActivity.this.mEndDate, MeasureCurveActivity.this.typeMode, true);
    MeasureCurveActivity.this.mViewportLeft = 0.0f;
    MeasureCurveActivity.this.mViewportRight = 0.0f;
    ((LineChartRenderer) MeasureCurveActivity.this.lineChart.getChartRenderer())
            .resetPointIndex();
    MeasureCurveActivity.this.requestMeasure();
}
 
Example 36
Project: MegviiFacepp-Android-SDK   File: FaceppActionActivity.java   Source Code and License 5 votes vote down vote up
private void onClickListener() {
    mListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            isShowListView();
            resolutionMap = cameraSize.get(position);
            String str = resolutionMap.get("width") + "*" + resolutionMap.get("height");
            mDialogUtil.setTextSzie(editItemTexts[1], str.length());
            editItemTexts[1].setText(str);
        }
    });
}
 
Example 37
Project: Tribe   File: InterceptLayout.java   Source Code and License 5 votes vote down vote up
public boolean avPullUpIntercept(View child) {
    boolean intercept = false;
    AdapterView adapterChild = (AdapterView) child;

    // 判断AbsListView是否已经到达内容最底部
    if (adapterChild.getLastVisiblePosition() == adapterChild.getCount() - 1
            && (adapterChild.getChildAt(adapterChild.getChildCount() - 1).getBottom() == getMeasuredHeight())) {
        // 如果到达底部,则拦截事件
        intercept = true;
    }
    return intercept;
}
 
Example 38
Project: q-mail   File: ManageIdentities.java   Source Code and License 5 votes vote down vote up
@Override
protected void setupClickListeners() {
    this.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            editItem(position);
        }
    });

    ListView listView = getListView();
    registerForContextMenu(listView);
}
 
Example 39
Project: iosched-reader   File: MapInfoFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    SessionAdapter adapter = (SessionAdapter) parent.getAdapter();

    final String sessionId = adapter.getSessionIdAtPosition(position);
    mCallback.onSessionClicked(sessionId);
}
 
Example 40
Project: MavsSnapUp   File: HomeActivity.java   Source Code and License 5 votes vote down vote up
private void loadListView() {
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, items);

    mListView.setAdapter(adapter);

    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Intent intent = new Intent(getBaseContext(), ItemDescActivity.class);
            intent.putExtra("itemKey", itemKeys.get(i));
            startActivity(intent);
        }
    });
}
 
Example 41
Project: boohee_v5.6   File: FollowListPage.java   Source Code and License 5 votes vote down vote up
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    boolean z = false;
    if (isRadioMode(this.platform.getName())) {
        if (this.lastPosition >= 0) {
            this.adapter.getItem(this.lastPosition).checked = false;
        }
        this.lastPosition = position;
    }
    Following following = this.adapter.getItem(position);
    if (!following.checked) {
        z = true;
    }
    following.checked = z;
    this.adapter.notifyDataSetChanged();
}
 
Example 42
Project: arduator   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    BtFoundDevice sel = (BtFoundDevice) spnDevices.getSelectedItem();
    config.setFavoriteBtDevice(sel.toString(), sel.getDevice().getAddress());
    device = sel.getDevice();
    updateButtons();
}
 
Example 43
Project: chromium-for-android-56-debug-video   File: PassphraseTypeDialogFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long typeId) {
    PassphraseType currentType = getCurrentTypeFromArguments();
    // We know this conversion from long to int is safe, because it represents very small
    // enum values.
    PassphraseType type = PassphraseType.fromInternalValue((int) typeId);
    boolean isEncryptEverythingAllowed = getIsEncryptEverythingAllowedFromArguments();
    if (currentType.getAllowedTypes(isEncryptEverythingAllowed).contains(type)) {
        if (typeId != currentType.internalValue()) {
            Listener listener = (Listener) getTargetFragment();
            listener.onPassphraseTypeSelected(type);
        }
        dismiss();
    }
}
 
Example 44
Project: MyFlightbookAndroid   File: ActNewAircraft.java   Source Code and License 5 votes vote down vote up
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
                           long arg3) {
    saveLastTail();
    Spinner sp = (Spinner) findViewById(R.id.spnAircraftType);
    m_ac.InstanceTypeID = sp.getSelectedItemPosition() + 1;
    toView();
}
 
Example 45
Project: Renrentou   File: CitySelectFragment.java   Source Code and License 5 votes vote down vote up
private void initProvince(){
    provinceListView = (ListView)popupView.findViewById(R.id.province_list);
    provinceAdapter = new ProvinceAdapter(getActivity());
    provinceListView.setAdapter(provinceAdapter);
    provinceListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Province province = getDefaultProvince();
            if(i != 0){
                province = provinceList.get(i-1);

            }else{

            }
            if(!currentProvince.getAreaId().equals(province.getAreaId())){
                currentProvince = province;
                cityList = province.getCities();
                currentCity = getDefaultCity();
                countyList.clear();
                currentCounty = getDefaultCounty();
                provinceAdapter.notifyDataSetChanged();
                cityAdapter.notifyDataSetChanged();
                countyAdapter.notifyDataSetChanged();
            }
        }
    });
}
 
Example 46
Project: VirtualHook   File: MaterialRippleLayout.java   Source Code and License 5 votes vote down vote up
private void clickAdapterView(AdapterView parent) {
    final int position = parent.getPositionForView(MaterialRippleLayout.this);
    final long itemId = parent.getAdapter() != null
        ? parent.getAdapter().getItemId(position)
        : 0;
    if (position != AdapterView.INVALID_POSITION) {
        parent.performItemClick(MaterialRippleLayout.this, position, itemId);
    }
}
 
Example 47
Project: sctalk   File: InternalFragment.java   Source Code and License 5 votes vote down vote up
private void initRes() {
    // 设置顶部标题栏
    setTopTitle(getActivity().getString(R.string.main_innernet));
    internalListView = (ListView)curView.findViewById(R.id.internalListView);
    internalListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            String url = mAdapter.getItem(i).getItemUrl();
            Intent intent=new Intent(InternalFragment.this.getActivity(),WebViewFragmentActivity.class);
            intent.putExtra(IntentConstant.WEBVIEW_URL, url);
            startActivity(intent);
        }
    });
}
 
Example 48
Project: PlusGram   File: LoginActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
    if (ignoreSelection) {
        ignoreSelection = false;
        return;
    }
    ignoreOnTextChange = true;
    String str = countriesArray.get(i);
    codeField.setText(countriesMap.get(str));
    ignoreOnTextChange = false;
}
 
Example 49
Project: android-apps   File: TouTiaoComActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  Map<String, Object> map = data.get(position);
  String title = map.get("title").toString();
  CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
      .setToolbarColor(getResources().getColor(R.color.colorPrimary)).setShowTitle(true).addDefaultShareMenuItem().build();
  CustomTabActivityHelper.openCustomTab(
      this, customTabsIntent, Uri.parse("http://www.toutiao.com/a" + map.get("group_id").toString()), new WebviewFallback());
}
 
Example 50
Project: AllTrans   File: AppListFragment.java   Source Code and License 5 votes vote down vote up
@SuppressLint("WorldReadableFiles")
    @Override
    public void onStart() {
        super.onStart();
        context = this.getActivity();
        //noinspection deprecation,deprecation
        BackupSharedPreferences.backupSharedPreferences(this.getActivity());
        settings = this.getActivity().getSharedPreferences("AllTransPref", MODE_WORLD_READABLE);
        mFirebaseAnalytics = FirebaseAnalytics.getInstance(context);

        SharedPreferences.Editor editor = settings.edit();
        editor.putBoolean("com.astroframe.seoulbus", true);
        editor.putBoolean("com.nhn.android.nmap", true);
        editor.putBoolean("com.kakao.taxi", true);
        editor.putBoolean("com.fineapp.yogiyo", true);
        editor.putBoolean("com.cgv.android.movieapp", true);
        editor.putBoolean("com.wooricard.smartapp", true);
        editor.putBoolean("com.google.android.talk", true);
        editor.putBoolean("com.ebay.global.gmarket", true);
        editor.putBoolean("com.foodfly.gcm", true);
        editor.putBoolean("com.ktcs.whowho", true);
        editor.putString("SubscriptionKey", "65044997b4194b8f8c181a15166fcb46");
//        editor.putBoolean("EnableYandex", true);
//        editor.putString("SubscriptionKey", "trnsl.1.1.20170118T002434Z.95dd93bf09dbc8d4.04554b9aac2c1bcfee17ee76bc9979236ea2c2d4");
        editor.apply();

        //noinspection ConstantConditions
        listview = (NestedScrollingListView) getView().findViewById(R.id.AppsList);

        new PrepareAdapter().execute();

        listview.setChoiceMode(NestedScrollingListView.CHOICE_MODE_MULTIPLE);
        listview.setNestedScrollingEnabled(true);
        listview.setFastScrollEnabled(true);

        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                ApplicationInfo curApp = (ApplicationInfo) parent.getItemAtPosition(position);
                utils.debugLog(curApp.packageName);
                LocalPreferenceFragment localPreferenceFragment = new LocalPreferenceFragment();
                localPreferenceFragment.applicationInfo = curApp;
                context.getSupportFragmentManager().beginTransaction()
                        .replace(R.id.toReplace, localPreferenceFragment)
                        .addToBackStack(null)
                        .commitAllowingStateLoss();
            }
        });
        fireBaseAnalytics();
    }
 
Example 51
Project: sealtalk-android-master   File: SealSearchMoreFriendsActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Object selectObject = parent.getItemAtPosition(position);
    if (selectObject instanceof Friend) {
        Friend friend = (Friend) selectObject;
        if (!TextUtils.isEmpty(friend.getDisplayName())) {
            RongIM.getInstance().startPrivateChat(SealSearchMoreFriendsActivity.this, friend.getUserId(), friend.getDisplayName());
        } else {
            RongIM.getInstance().startPrivateChat(SealSearchMoreFriendsActivity.this, friend.getUserId(), friend.getName());
        }
    }
}
 
Example 52
Project: EmotionApp   File: GlobalOnItemClickManagerUtils.java   Source Code and License 5 votes vote down vote up
public AdapterView.OnItemClickListener getOnItemClickListener(final Context context, final int emotion_map_type) {
    return new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Object itemAdapter = parent.getAdapter();

            if (itemAdapter instanceof EmotionGridViewAdapter) {
                // 点击的是表情
                EmotionGridViewAdapter emotionGvAdapter = (EmotionGridViewAdapter) itemAdapter;

                if (position == emotionGvAdapter.getCount() - 1) {
                    // 如果点击了最后一个回退按钮,则调用删除键事件
                    mEditText.dispatchKeyEvent(new KeyEvent(
                            KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
                } else {
                    // 如果点击了表情,则添加到输入框中
                    String emotionName = emotionGvAdapter.getItem(position);

                    // 获取当前光标位置,在指定位置上添加表情图片文本
                    int curPosition = mEditText.getSelectionStart();
                    StringBuilder sb = new StringBuilder(mEditText.getText().toString());
                    sb.insert(curPosition, emotionName);

                    // 特殊文字处理,将表情等转换一下
                    mEditText.setText(SpanStringUtils.getEmotionContent(emotion_map_type,
                            context, mEditText, sb.toString()));

                    // 将光标设置到新增完表情的右侧
                    mEditText.setSelection(curPosition + emotionName.length());
                }

            }
        }
    };
}
 
Example 53
Project: sctalk   File: SearchAdapter.java   Source Code and License 5 votes vote down vote up
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    Object object = getItem(position);
    if (object instanceof UserEntity) {
        UserEntity userEntity = (UserEntity) object;
        IMUIHelper.handleContactItemLongClick(userEntity, ctx);
    } else {
    }
    return true;
}
 
Example 54
Project: Swift-Braille-Soft-keyboard   File: AdvancedActivity.java   Source Code and License 5 votes vote down vote up
private void initListeners(final AdapterView.OnItemSelectedListener listener) {
    try{
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                stopOverDotSpinner.setOnItemSelectedListener(listener);
                selectedDotsPeriodSpinner.setOnItemSelectedListener(listener);
            }
        }, 500);
    } catch(Exception e){
        e.printStackTrace();
    }
}
 
Example 55
Project: EsperantoRadio   File: Kanal_frag.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> listView, View v, int position, long id) {
  Object o = liste.get(position);
  // PinnedSectionListView tillader klik på hængende overskrifter, selvom adapteren siger at det skal den ikke
  if (!(o instanceof Udsendelse)) return;
  Udsendelse u = (Udsendelse) o;
  if (position == 0 || position == liste.size() - 1) {
    hentSendeplanForDag(u.startTid);
    v.findViewById(R.id.titel).setVisibility(View.GONE);
    v.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
  } else {
    //startActivity(new Intent(getActivity(), VisFragment_akt.class)
    //    .putExtra(P_KANALKODE, getKanal.kode)
    //    .putExtra(VisFragment_akt.KLASSE, Udsendelse_frag.class.getName()).putExtra(P_UDSENDELSE, u.slug)); // Udsenselses-ID
    String aktuelUdsendelseSlug = aktuelUdsendelseIndex > 0 ? ((Udsendelse) liste.get(aktuelUdsendelseIndex)).slug : "";

    // Vis normalt et Udsendelser_vandret_skift_frag med flere udsendelser
    // Hvis tilgængelighed er slået til (eller bladring slået fra) vises blot ét Udsendelse_frag
    Fragment f =
        App.accessibilityManager.isEnabled() || !App.prefs.getBoolean("udsendelser_bladr", true) ? Fragmentfabrikering.udsendelse(u) :
            new Udsendelser_vandret_skift_frag();
    f.setArguments(new Intent()
        .putExtra(P_KANALKODE, kanal.kode)
        .putExtra(Udsendelse_frag.AKTUEL_UDSENDELSE_SLUG, aktuelUdsendelseSlug)
        .putExtra(P_UDSENDELSE, u.slug)
        .getExtras());
    getActivity().getSupportFragmentManager().beginTransaction()
        .replace(R.id.indhold_frag, f)
        .addToBackStack(null)
        .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
        .commitAllowingStateLoss(); // Fix for https://www.bugsense.com/dashboard/project/cd78aa05/errors/830038058
    Sidevisning.vist(Udsendelse_frag.class, u.slug);
  }
}
 
Example 56
Project: Android_RuuvitagScannner   File: ListActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);
    ruuvitagArrayList = new ArrayList<>();
    settings = PreferenceManager.getDefaultSharedPreferences(this);

    handler = new DBHandler(getApplicationContext());
    db = handler.getReadableDatabase();

    cursor = db.rawQuery("SELECT * FROM " + DBContract.RuuvitagDB.TABLE_NAME, null);
    beaconListView = (ListView)findViewById(R.id.listView);
    adapter = new listAdapter(ruuvitagArrayList, this);
    beaconListView.setAdapter(adapter);

    savedTags = getSharedPreferences("saved_tags", MODE_PRIVATE);
    gson = new Gson();

    beaconListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Intent intent = new Intent(ListActivity.this, ScannerService.class);
            Ruuvitag temp = (Ruuvitag) adapterView.getItemAtPosition(i);
            intent.putExtra("favorite", temp);
            startService(intent);
            finish();
        }
    });
}
 
Example 57
Project: android-apps   File: TuiCoolActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  Map<String, Object> map = data.get(position);
  String topic_id = map.get("href").toString();
  CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder()
      .setToolbarColor(getResources().getColor(R.color.colorPrimary)).setShowTitle(true).addDefaultShareMenuItem().build();
  CustomTabActivityHelper.openCustomTab(
      this, customTabsIntent, Uri.parse(topic_id), new WebviewFallback());
}
 
Example 58
Project: android-chessclock   File: SettingsFragment.java   Source Code and License 5 votes vote down vote up
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            if (mListener != null && mListView != null) {
                mItemChecked = position - mListView.getHeaderViewsCount();
                mListener.setCheckedTimeControlIndex(mItemChecked);
            }
        }
 
Example 59
Project: AutocompleteLocation   File: AutoCompleteLocation.java   Source Code and License 5 votes vote down vote up
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  UIUtils.hideKeyboard(AutoCompleteLocation.this.getContext(), AutoCompleteLocation.this);
  final AutocompletePrediction item = mAutoCompleteAdapter.getItem(position);
  if (item != null) {
    final String placeId = item.getPlaceId();
    PendingResult<PlaceBuffer> placeResult =
        Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId);
    placeResult.setResultCallback(mUpdatePlaceDetailsCallback);
  }
}
 
Example 60
Project: simple-stack   File: FriendListView.java   Source Code and License 5 votes vote down vote up
public void setFriends(List<User> friends) {
    Adapter adapter = new Adapter(getContext(), friends);

    setAdapter(adapter);
    setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            BackstackService.get(getContext()).goTo(FriendPath.create(position));
        }
    });
}