小编anu*_*nup的帖子

如何检查所有浏览器都支持的相机权限?

我使用以下代码来检查我的反应应用程序是否具有相机权限:-

  checkForCameraPermission = () => {
    try {
      navigator.permissions.query({ name: 'camera' }).then(permissionStatus => {
        // granted, denied, prompt
        switch (permissionStatus.state) {
          case 'denied':
            // eslint-disable-next-line no-alert
            // alert(
            //   'You need to provide camera permission and reload page to continue futher with KYC journey or else please download the EarlySalary App to continue further.'
            // );
            this.setState({
              cameraDialogStatus: true
            });

            break;
          default:
            break;
        }
        // eslint-disable-next-line no-param-reassign
        permissionStatus.onchange = () => {
          console.log(`Permission changed to ${this.state}`);
        };
      });
    } catch …
Run Code Online (Sandbox Code Playgroud)

javascript permissions reactjs next.js

5
推荐指数
0
解决办法
1158
查看次数

如何在recyclerview中隐藏字符串的一部分?

我有一个recyclerview,我显示一个字符串,其中包含一个id,名称和联系人编号作为单个字符串.我想隐藏字符串中的id.我使用以下代码将字符串添加到数组列表.我在文本视图中显示连接的字符串,如(1-XYZ 0123456789)

   private void showGuestDetails(String response) {
        Guest_info guest_info = new Guest_info(response);
        guest_info.ParseGuestInfo();

        String guestid[] = guest_info.guest_id;

        for (int i = 0; i < guestid.length; i++) {
            list.add(guest_info.guest_id[i] + "-" + guest_info.guest_name[i] + "  " + guest_info.guest_mobile[i]);

        }
    }
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的适配器类: -

public class GuestAdapter extends RecyclerView.Adapter<GuestAdapter.GuestViewHolder> {

    private List<String> list_item ;
    public Context mcontext;
    private BookingActivity bookingActivity;


    public GuestAdapter(List<String> list, Context context, BookingActivity bookingActivity) {

        list_item = list;
        mcontext = context;
        this.bookingActivity =bookingActivity;
    }

    // Called when RecyclerView needs a …
Run Code Online (Sandbox Code Playgroud)

java string android arraylist textview

0
推荐指数
1
解决办法
206
查看次数