E-Commerce App Source Code (Part - 5)
Android Tutorials Point
The Best Android Apps Source Code
Welcome Dear Viewers,
The best Android Apps Source Code is available at one place. So to make The best E-Commerce App just copy these codes into your App and Run any time. Literally I have explained each steps in this Tutorial.
This is Only page setup coding & next parts will be publishing soon here too.
I will show you their XML code and Java code for more clarification. So Lets start our Source Code.
Note: In Layouts we will use Glide Library to download image , icons , colors and ids from server side panel or randomly downloads from internet, because it will be fetch all attributes from server side panel that will be created soon. So don't be confuse😇 and follow all steps.
To pick glide library click the link below
https://github.com/bumptech/glide
Video Intro:
Glide Library:
Dependency:
.....................................................................................................................................................
Category Adapter Activity (Java File)
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.appcompat.view.menu.MenuView;
import androidx.recyclerview.widget.RecyclerView;
import com.example.e_shop.R;
import com.example.e_shop.databinding.ItemCategoriesBinding;
import com.example.e_shop.models.Category;
import java.util.ArrayList;
import java.time.Instant glide;
public class CatagoryAdapter extends RecyclerView.Adapter<CatagoryAdapter.categoryViewHolder> {
Context context;
ArrayList<Category>categories;
public CatagoryAdapter(Context context,ArrayList<Category>categories){
this.context = context;
this.categories = categories;
}
@NonNull
@Override
public categoryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new categoryViewHolder(LayoutInflater.from(context).inflate(R.layout.item_categories,parent,false));
}
@Override
public void onBindViewHolder(@NonNull categoryViewHolder holder, int position) {
Category category = categories.get(position);
holder.binding.label.setText(category.getName());
glide.with(context)
.load(category.getIcon())
.into(holder.binding.imageView);
holder.binding.imageView.setBackgroundColor(category.getColor());
}
@Override
public int getItemCount() {
categories.size();
return 0;
}
public class categoryViewHolder extends RecyclerView.ViewHolder{
ItemCategoriesBinding binding;
public categoryViewHolder(@NonNull View itemView) {
super(itemView);
binding = ItemCategoriesBinding.bind(itemView);
}
}
}
.................................................................
All the Best 😇
Best Regards
Android Tutorials Point
To understand the tutorial step by step you have to be watch video from here.
Playlist of E-Commerce App YouTube Link.
https://www.youtube.com/playlist?list=PLLpZnoKq_Rexp5iX1rJXnqmWM-OelcmCg


Comments
Post a Comment