Example usage for android.widget AdapterView getId

List of usage examples for android.widget AdapterView getId

Introduction

In this page you can find the example usage for android.widget AdapterView getId.

Prototype

@IdRes
@ViewDebug.CapturedViewProperty
public int getId() 

Source Link

Document

Returns this view's identifier.

Usage

From source file:com.mifos.mifosxdroid.online.createnewgroup.CreateNewGroupFragment.java

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (parent.getId() == R.id.sp_group_offices) {
        officeId = officeList.get(position).getId();
    }// ww  w  .j a va  2s. c  o  m
}

From source file:com.mifos.mifosxdroid.online.savingsaccount.SavingsAccountFragment.java

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    switch (parent.getId()) {
    case R.id.sp_field_officer:
        fieldOfficerId = mSavingProductsTemplateByProductId.getFieldOfficerOptions().get(position).getId();
        break;/*  w  w w  .  ja  v a  2  s.  c  o  m*/
    case R.id.sp_product:
        productId = mProductSavings.get(position).getId();
        if (isGroupAccount) {
            mSavingsAccountPresenter.loadGroupSavingAccountTemplateByProduct(groupId, productId);
        } else {
            mSavingsAccountPresenter.loadClientSavingAccountTemplateByProduct(clientId, productId);
        }
        break;
    }
}

From source file:com.stephenmcgruer.simpleupnp.fragments.ServerBrowserFragment.java

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    switch (adapterView.getId()) {
    case R.id.server_browser_list:
        DeviceWrapper deviceWrapper = (DeviceWrapper) adapterView.getItemAtPosition(position);
        mListener.onServerSelected(deviceWrapper.getDevice());
        break;//from  ww  w .ja v a2  s.  com
    case R.id.bookmarks_list:
        BookmarkWrapper bookmarkWrapper = (BookmarkWrapper) adapterView.getItemAtPosition(position);
        mListener.onBookmarkSelected(bookmarkWrapper.getBookmark());
        break;
    }
}

From source file:ca.marcmeszaros.papyrus.browser.BooksBrowser.java

@Override
public void onItemSelected(AdapterView<?> adapter, View selected, int position, long id) {
    switch (adapter.getId()) {
    case R.id.BooksBrowser_spinner_library:
        String selection = PapyrusContentProvider.Books.FIELD_LIBRARY_ID + "=?";
        String[] selectionArgs = { Long.toString(id) };
        Cursor result = resolver.query(PapyrusContentProvider.Books.CONTENT_URI, null, selection, selectionArgs,
                PapyrusContentProvider.Books.FIELD_TITLE);
        ((BookAdapter) ((ListView) findViewById(android.R.id.list)).getAdapter()).changeCursor(result);
        break;//from   w w  w.  jav a 2s  .  c  o  m

    default:
        break;
    }
}

From source file:com.example.venkatagovardhan.docorganizer.FolderActivity.java

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    switch (arg0.getId()) {
    case R.id.listNavigation:
        NavDrawerItem item = (NavDrawerItem) arg0.getItemAtPosition(arg2);
        if (item.onClicked(this))
            drawerLayout.closeDrawers();
        break;//from w w w  .  j  a  v  a2 s  . c  om

    case R.id.listClipboard:
        FolderFragment folderFragment = getFolderFragment();
        if (folderFragment != null) {
            // TODO: paste single file
        }
        break;

    default:
        break;
    }
}

From source file:org.isoron.uhabits.fragments.ShowHabitFragment.java

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (parent.getId() == R.id.sStrengthInterval)
        setScoreBucketSize(position);//from w  w  w .  j ava2 s  . c  om
}

From source file:com.h6ah4i.android.example.openslmediaplayer.app.contents.HQVisualizerFragment.java

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    switch (parent.getId()) {
    case R.id.spinner_hq_visualizer_window_type:
        postAppEvent(HQVisualizerReqEvents.SET_WINDOW_TYPE, listPositionToWindowType(position), 0);
        break;// ww  w. ja  v  a2 s.  c o m
    }
}

From source file:de.vanita5.twittnuker.activity.support.UserListSelectorActivity.java

@Override
public void onItemClick(final AdapterView<?> view, final View child, final int position, final long id) {
    final int view_id = view.getId();
    final ListView list = (ListView) view;
    if (view_id == R.id.users_list) {
        final ParcelableUser user = mUsersAdapter.getItem(position - list.getHeaderViewsCount());
        if (user == null)
            return;
        if (isSelectingUser()) {
            final Intent data = new Intent();
            data.setExtrasClassLoader(getClassLoader());
            data.putExtra(EXTRA_USER, user);
            setResult(RESULT_OK, data);//from   w w  w.j a v a  2  s. c om
            finish();
        } else {
            getUserLists(user.screen_name);
        }
    } else if (view_id == R.id.user_lists_list) {
        final Intent data = new Intent();
        data.putExtra(EXTRA_USER_LIST, mUserListsAdapter.getItem(position - list.getHeaderViewsCount()));
        setResult(RESULT_OK, data);
        finish();
    }
}

From source file:org.totschnig.myexpenses.activity.AccountEdit.java

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    setDirty(true);/*w w  w  .j  a va 2  s.  c  om*/
    switch (parent.getId()) {
    case R.id.Color:
        if (mColors.get(position) != 0)
            mAccount.color = mColors.get(position);
        break;
    case R.id.Currency:
        try {
            mAmountText.setFractionDigits(
                    Money.getFractionDigits(Currency.getInstance(CurrencyEnum.values()[position].name())));
        } catch (IllegalArgumentException e) {
            //will be reported to user when he tries so safe
        }
        break;
    }
}

From source file:com.mstoyanov.music_lessons.StudentsFragment.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (parent.getId()) {
    case R.id.students_list:
        Cursor cursor = (Cursor) parent.getItemAtPosition(position);
        studentId = cursor.getInt(cursor.getColumnIndex("_id"));
        String firstName = cursor.getString(cursor.getColumnIndex("firstName"));
        String lastName = cursor.getString(cursor.getColumnIndex("lastName"));
        if (dualPane) {
            studentsList.setItemChecked(position, true);
            selectedStudent = position;//  www . ja va  2 s  .c om

            selectionArgs[0] = String.valueOf(studentId);

            firstNameLabel.setText("First Name");
            firstNameTextView.setText(firstName);
            lastNameLabel.setText("Last Name");
            lastNameTextView.setText(lastName);

            getLoaderManager().restartLoader(STUDENT_DETAILS_LOADER, null, this);
        } else {
            Intent intent = new Intent(getActivity(), StudentDetailsActivity.class);
            intent.putExtra("STUDENT_ID", studentId);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
        }
        break;
    case R.id.student_details_list:
        Actions action = actions.get(position);
        switch (action.getType()) {
        case Actions.ACTION_CALL:
            Uri callUri = Uri.parse("tel:" + action.getData());
            Intent intent = new Intent(Intent.ACTION_CALL, callUri);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            break;
        case Actions.ACTION_EMAIL:
            intent = new Intent(Intent.ACTION_SEND);
            intent.setType("plain/text");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { action.getData() });
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            break;
        case Actions.ACTION_SMS:
            Uri smsUri = Uri.parse("sms:" + action.getData());
            intent = new Intent(Intent.ACTION_VIEW, smsUri);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
        default:
            throw new IllegalArgumentException("Invalid action type: " + action.getType());
        }
    default:
        throw new IllegalArgumentException("Invalid parentId: " + parent.getId());
    }
}