public void OnSend(View v){ String phoneNumber = number.getText().toString(); String smsmessage = message.getText().toString(); if(phoneNumber == null || phoneNumber.length() == 0 || smsmessage ==...



public void OnSend(View v){


        String phoneNumber = number.getText().toString();


        String smsmessage = message.getText().toString();


        if(phoneNumber == null || phoneNumber.length() == 0 || smsmessage == null || smsmessage.length() == 0){


            return;


        }


        if(checkPermission(Manifest.permission.SEND_SMS)){


            SmsManager smsManager = SmsManager.getDefault();


            smsManager.sendTextMessage(phoneNumber, null, smsmessage, null, null);


            Toast.makeText(this, "Message sent", Toast.LENGTH_SHORT).show();


        }






Question 2:


Explain the following code:


button.setOnClickListener(new View.OnClickListener() {


            @Override


            public void onClick(View v) {


                FragmentManager fm = getSupportFragmentManager();


                FragmentTransaction ft = fm.beginTransaction();


                XFragment xfragment = new XFragment();


                ft.add(R.id.Main_fragment, xfragment);


                ft.commit();


            }


        });





Question 3:


Explain the following code:


  @NonNull


    @Override


    public houseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {


        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_layout, null, false);


        ViewHolder viewHolder = new ViewHolder(v);


        return null;


    }



Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here