Interface And Cloud Messaging in Android | CodersArts

Interface :

i. In android interface is very useful concept with the interface we are able to access List of items in Recycler view adapter in simple word we can easily access multiple users like whatsapp we are able to send the message multiple users.

ii. we are able to implement onClickListenr and onLongClick Listener into the same user with onclick listener we are able to go to the user location or another activity

iii. with the on long Click listener we are able to perform another activity into the

same account.

iv, user is able to go to the location of his friend if he is lost

v. Able to communicate multiple users at same time.




Cloud Messaging :

i. With the help of Retrofit api we are able to friend request to the another user

ii. We are able to communicate with the users with this api and user is able to send to communicate with another user easily and able to send details over messaging platform.

Code Interface :

public interface ItemClickListener { void onClick(View view,int position); void onItemLongClick(View view,int position); }

MyAdapeter.java


public class MyAdapter extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { public TextView textEmail; ItemClickListener itemClickListener; public void setItemClickListener(ItemClickListener itemClickListener) { this.itemClickListener = itemClickListener; } public MyAdapter(@NonNull View itemView) { super(itemView); textEmail=itemView.findViewById(R.id.txt_email); itemView.setOnClickListener(this); } @Override public void onClick(View v) { itemClickListener.onClick(v,getAdapterPosition()); } @Override public boolean onLongClick(View v) { itemClickListener.onItemLongClick(v, getAdapterPosition()); return true; } }


Mainn.java inside OnbindActivity


holder.setItemClickListener(new ItemClickListener() { @Override public void onClick(View view, int position) { if(!model.getEmail().equals(FirebaseAuth.getInstance().getCurrentUser().getEmail())) { Toast.makeText(Online.this, "Lets Go", Toast.LENGTH_SHORT).show(); Intent map=new Intent(Online.this,MapsActivity.class); map.putExtra("email",model.getEmail()); map.putExtra("lat",mlocation.getLatitude()); map.putExtra("lng",mlocation.getLongitude()); startActivity(map); } } @Override public void onItemLongClick(View view, int position) { showDialogRequest(model); } });


Hire an android developer to get quick help for all your android app development needs. with the hands-on android assignment help and android project help by Codersarts android expert. You can contact the android programming help expert any time; we will help you overcome all the issues and find the right solution.

Want to get help right now? Or Want to know price quote

Please send your requirement files at contact@codersarts.com. and you'll get instant reply as soon as requirement receives



6 views0 comments

Recent Posts

See All