예제 #1
0
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_CALL);

            // Sending call intent and hoping that we will have lucky
            intent.setData(Uri.parse(TEL_SCHEMA + ":" + qrCode.getTelephone()));
            Resources res = context.getResources();
            context.startActivity(
                Intent.createChooser(intent, res.getString(R.string.QrCode_Title_Telephone_Call)));
          }
예제 #2
0
    /**
     * Gets the view for Telephone QR code.
     *
     * @see com.android.qrreader.qrcode.views.QrCodeViewProvider#getView(android.content.Context)
     *     getView(Context)
     */
    public View getView(Context context) {
      if (resultView == null) { // Instantiate just once per this instance of the provider
        this.context = context;
        LayoutInflater resultInflater = LayoutInflater.from(context);
        resultView = (RelativeLayout) resultInflater.inflate(R.layout.openqr_view_telephone, null);

        // Getting references and setting on call click listener
        Button callButton = (Button) resultView.findViewById(R.id.callButton);
        TextView telephoneNumber = (TextView) resultView.findViewById(R.id.telephoneNumber);
        telephoneNumber.setText(qrCode.getTelephone());
        callButton.setOnClickListener(onClickCallButton);
      }

      return resultView;
    }