by using private List appProcessInfos; am getting the total package name example "com.example.app" but what i need is the app name. Another thing is that am getting the system app also which is not need, only the user running app details i need. Thanks in advance any help or suggestion would be greatly appreciated.
public class ShowAppAdapter extends RecyclerView.Adapter<ShowAppAdapter.ShowAppAdapterViewHolder> {
private List<ActivityManager.RunningAppProcessInfo> appProcessInfos;
public ShowAppAdapter(List<ActivityManager.RunningAppProcessInfo> appProcessInfos){
this.appProcessInfos = appProcessInfos;
}
@NonNull
@Override
public ShowAppAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View view = layoutInflater.inflate(R.layout.appshow_layout, parent,false);
return new ShowAppAdapterViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ShowAppAdapterViewHolder holder, int position) {
String title = String.valueOf(appProcessInfos.get(position).processName);
holder.textView.setText(title);
}
@Override
public int getItemCount() {
return appProcessInfos.size();
}
public class ShowAppAdapterViewHolder extends RecyclerView.ViewHolder {
TextView textView;
ImageView imageView;
public ShowAppAdapterViewHolder(View itemView) {
super(itemView);
textView = itemView.findViewById(R.id.textView);
imageView = itemView.findViewById(R.id.imageView);
}
}
}
this is my Adapter class.