Passing data from ListView to activity upon onclick - android

AuctionList.java
public class AuctionList extends AppCompatActivity {
ListView mListView;
ArrayList<Model> mList;
AuctionListAdapter mAdapter = null;
DatabaseHelperUpload mDBUpload;
TextView txtName,txtDescription,txtDuration,txtPrice;
ImageView imageViewIcon;
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.auction_list);
mDBUpload = new DatabaseHelperUpload(this);
mListView = findViewById(R.id.listView);
mList = new ArrayList<>();
mAdapter = new AuctionListAdapter(this,R.layout.row,mList);
mListView.setAdapter(mAdapter);
txtName = findViewById(R.id.txtName);
txtDescription = findViewById(R.id.txtDescription);
txtDuration = findViewById(R.id.txtDescription);
txtPrice = findViewById(R.id.txtPrice);
}
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String name = txtName.getText().toString();
String description = txtDescription.getText().toString();
String price = txtPrice.getText().toString();
String duration = txtDuration.getText().toString();
Intent intent5 = new Intent(AuctionList.this,BuyerHome.class);
intent5.putExtra("name",name);
intent5.putExtra("description",description);
intent5.putExtra("price",price);
intent5.putExtra("duration",duration);
startActivity(intent5);
}
});
Activity.java
Bundle bundle = getIntent().getExtras();
String duration = bundle.getString("duration");
String price = bundle.getString("price");
TextView durationLog = (TextView)findViewById(R.id.text_view_countdown);
TextView priceLog = (TextView)findViewById(R.id.textPrice);
durationLog.setText(duration);
priceLog.setText(price);
Model.java
public class Model {
private int id;
private String name;
private String duration;
private String description;
private String price;
private byte[] image;
public Model(int id, String name,String description,String price,String duration, byte[] image) {
this.id = id;
this.name = name;
this.description = description;
this.price = price;
this.duration = duration;
this.image = image;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDuration() {
return duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public byte[] getImage() {
return image;
}
public void setImage(byte[] image) {
this.image = image;
}
}
The activity.java codes are partial as I am still trying out. So I am just trying to get two data(duration and price).
However, I am having error and my app kept crashing. May I kindly ask what is wrong with my codes. I actually have a Model code as shown.
The error is:
2019-03-23 00:30:58.046 11048-11048/com.example.jianminmong.aucon E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.jianminmong.aucon, PID: 11048
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.widget.TextView.getText()' on a null object reference
at com.example.jianminmong.aucon.AuctionList$1.onItemClick(AuctionList.java:63)
at android.widget.AdapterView.performItemClick(AdapterView.java:318)
at android.widget.AbsListView.performItemClick(AbsListView.java:1159)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3136)
at android.widget.AbsListView$3.run(AbsListView.java:4052)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Really appreciate some help here as this is the last part for my final year project. I am a amateur here by the way,so the more I am in need of help.
I basically just want to retrieve the data from the listview accordingly and just initialise the values, &&& it should not keep resetting the data back whenever i press it,because the activity requires it to run in the background(such as the timer)

Problem with your Textview when you getText from Textview that time any one Textview is not bind with xml that's why your app was crashed.
mListView.setOnItemClickListener(new.
AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent,
View view, int position, long id) {
String name = txtName.getText().toString();
String description =
txtDescription.getText().toString();
String price = txtPrice.getText().toString();
String duration = txtDuration.getText().toString();
Intent intent5 = new Intent(AuctionList.this,BuyerHome.class);
intent5.putExtra("name",name);
intent5.putExtra("description",description);
intent5.putExtra("price",price);
intent5.putExtra("duration",duration);
startActivity(intent5);
}
});

Related

Onclick listener on recyclerview to display image

so far I have a click listener for my recycler view to display the content in the next activity but I'm trying to display the image on the next activity but it doesn't seem to help to load can anyone help me, please? I put the productactivity for context reasons the issue is the image isn't being sent to the next activity through the intent.
#Override
public void onBindViewHolder(#NonNull final SearchViewHolder holder, final int position) {
//Loads the variables on to the recyclerview
holder.name.setText(products.get(position).getName());
holder.price.setText(products.get(position).getPrice());
holder.year.setText(products.get(position).getYear());
holder.location.setText(products.get(position).getLocation());
Glide.with(context)
.load(products.get(position).getImage1())
.into(holder.image);
//Onclick Listener to view all details of the car
holder.itemView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//Create a new intent
Intent intent = new Intent(context, ProductActivity.class);
intent.putExtra("name", products.get(position).getName());
intent.putExtra("price", products.get(position).getPrice());
intent.putExtra("year", products.get(position).getYear());
intent.putExtra("location", products.get(position).getLocation());
intent.putExtra("mileage", products.get(position).getMileage());
intent.putExtra("colour", products.get(position).getColour());
intent.putExtra("image1",products.get(position).getImage1());
context.startActivity(intent);
}
});
}
Edited: added the productActivity for context reasons
public class ProductActivity extends AppCompatActivity {
//Declare variables
ImageView imageView;
TextView text1, text2, text3, text4, text5, text6;
Button btn;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product);
//Assign variables
imageView = findViewById(R.id.carIv);
text1 = findViewById(R.id.nameTv);
text2 = findViewById(R.id.locationTv);
text3 = findViewById(R.id.mileageTv);
text4 = findViewById(R.id.colourTv);
text5 = findViewById(R.id.yearTv);
text6 = findViewById(R.id.priceTv);
imageView = findViewById(R.id.carIv);
btn = findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
addToCart();
}
});
//Create Bundle
Bundle bundle = getIntent().getExtras();
String name = bundle.getString("name");
String location = bundle.getString("location");
String mileage = bundle.getString("mileage");
String colour = bundle.getString("colour");
String year = bundle.getString("year");
String price = bundle.getString("price");
Integer image1 = bundle.getInt("image1");
//Set name to textview
text1.setText(name);
text2.setText(location);
text3.setText(mileage);
text4.setText(colour);
text5.setText(year);
text6.setText(price);
imageView.setImageResource(image1);
}
Products.java
public class Products {
public String name, price, location, mileage, colour, year, image1, image2, image3;
public Products(){}
public Products(String name, String price, String location, String mileage, String colour, String year, String image1, String image2, String image3) {
this.name = name;
this.price = price;
this.location = location;
this.mileage = mileage;
this.colour = colour;
this.year = year;
this.image1 = image1;
this.image2 = image2;
this.image3 = image3;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getMileage() {
return mileage;
}
public void setMileage(String mileage) {
this.mileage = mileage;
}
public String getColour() {
return colour;
}
public void setColour(String colour) {
this.colour = colour;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getImage1() {
return image1;
}
public void setImage1(String image1) {
this.image1 = image1;
}
public String getImage2() {
return image2;
}
public void setImage2(String image2) {
this.image2 = image2;
}
public String getImage3() {
return image3;
}
public void setImage3(String image3) {
this.image3 = image3;
}
}
Try with
String image1 = bundle.getStringExtra("image1");
then for loading Image to the ImageView.
Glide.with(this)
.load(image1)
.into(imageView);

how to retrieve image url from firebase database

i am retrieving data from my database such as any data field.
i am able to get fields such as location, country and address.
what i am struggling with is getting the image url from the database in order to insert it into my picasso function.
here is my java code:
private FirebaseFirestore firebaseFirestore;
private RecyclerView FirestoreList;
private FirestoreRecyclerAdapter adapter;
FirestoreList = findViewById(R.id.recycler_view);
firebaseFirestore = FirebaseFirestore.getInstance();
Query q = firebaseFirestore.collection("Shops");
//recycle options
FirestoreRecyclerOptions<Shop> options = new FirestoreRecyclerOptions.Builder<Shop>()
.setQuery(q, Shop.class)
.build();
adapter = new FirestoreRecyclerAdapter<Shop, ShopViewHolder>(options) {
#NonNull
#Override
public ShopViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.shop_item,parent,false);
return new ShopViewHolder(view);
}
#RequiresApi(api = Build.VERSION_CODES.M)
#Override
protected void onBindViewHolder(#NonNull ShopViewHolder holder, int position, #NonNull Shop model) {
holder.list_name.setText(model.getName());
holder.list_location.setText(model.getLocation());
//here is where i should be able to get my image url from the database.
i tried doing it this way but there is always and error or incompatibility.
holder.header_img.setText(model.getShopHeaderImg());
holder.header_img.setImageURI(model.getShopHeaderImg());
//all of these give me an error, so what is the correct methodology to retrieve the image url??
}
};
FirestoreList.setHasFixedSize(true);
FirestoreList.setLayoutManager(new LinearLayoutManager(this));
FirestoreList.setAdapter(adapter);
here is where i should be getting my values:
private class ShopViewHolder extends RecyclerView.ViewHolder {
private TextView list_name;
private TextView list_location;
private ImageView header_img;
public ShopViewHolder(#NonNull View itemView) {
super(itemView);
Shop MyShop = new Shop();
String image = MyShop.getShopHeaderImg();
list_name = itemView.findViewById(R.id.list_name);
list_location = itemView.findViewById(R.id.list_location);
header_img = itemView.findViewById(R.id.header_img);
Picasso.get().load(image).into(header_img);
}
}
this is my shop class:
public class Shop {
private String name;
private String country;
private String address;
private String location;
private String ShopHeaderImg;
//private int priority;
public Shop(){
}
public Shop(String name, String country, String address, String location, String ShopHeaderImg) {
this.name = name;
this.country = country;
this.address = address;
this.location = location;
this.ShopHeaderImg = ShopHeaderImg;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getShopHeaderImg() {
return ShopHeaderImg;
}
public void setShopHeaderImg(String ShopHeaderImg) {
this.ShopHeaderImg = ShopHeaderImg;
}
}
how will i be able to retrieve the image url into the getShopHeaderImg() method
check this
put this method inside your viewHolder
public void setHeaderImage(final Context c , final String Image){
final ImageView headerImg = (ImageView)itemView.findViewById(R.id.headerImage);
Picasso.with(c).load(Image).into(headerImg);
}
and use the method inside onBindViewHolder
holder.setHeaderImage(getApplicationContext(),model.getShopHeaderImg());

How do I get only the values insided an array on a texview

I've been trying to show my array of foods on a textview from my Firestore Database. I have been able to view the array on the textview but it is not readable by lame readers, they show in the array braces and the curly brackets. I want to extract the values like produName, Quantity, etc independently
Below is my Model class and Activity class.
public class Request {
private String phone;
private String name;
private String address;
private String total;
private String status;
private List<HashMap<String, String>> foods; //list of food orders
private #ServerTimestamp Date timestamp;
public Request() {
}
public Request(String phone, String name, String address, String total, List<HashMap<String, String>> foods) {
this.phone = phone;
this.name = name;
this.address = address;
this.total = total;
this.foods = foods;
this.status = "0"; //Default is 0, 0: Place, 1: Shipping, 2: Shipped
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTotal() {
return total;
}
public void setTotal(String total) {
this.total = total;
}
public List<HashMap<String, String>> getFoods() {
return foods;
}
public void setFoods(List<HashMap<String, String>> foods) {
this.foods = foods;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
MY ACTIVITY CLASS, I implemented call to firestore at onStart()
#Override
protected void onStart() {
super.onStart();
FirestoreRecyclerOptions<Request> options = new FirestoreRecyclerOptions.Builder<Request>()
.setQuery(query, Request.class)
.build();
adapter = new FirestoreRecyclerAdapter<Request, MainActivity.DataViewHolder>(options) {
#Override
protected void onBindViewHolder(#NonNull MainActivity.DataViewHolder dataViewHolder, int i, #NonNull final Request mainMenuItem) {
dataViewHolder.setData(mainMenuItem.getTotal(), mainMenuItem.getName(), mainMenuItem.getStatus(), mainMenuItem.getPhone(),
mainMenuItem.getAddress(), mainMenuItem.getTimestamp(), mainMenuItem.getFoods());}
#NonNull
#Override
public MainActivity.DataViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.order_layout, parent, false);
return new MainActivity.DataViewHolder(view);
}
};
recyclerView.setAdapter(adapter);
adapter.startListening();
}
public class DataViewHolder extends RecyclerView.ViewHolder {
private View view;
DataViewHolder(View itemView) {
super(itemView);
view = itemView;
}
void setData(String orderTotalValue, String nameOfPerson, String dataOrderStatus, String dataOrderPhone, String dataOrderAddress,
Date dataDateAndTime, final List<HashMap<String,String>>foodsOrdered) {
TextView orderTotal = view.findViewById(R.id.order_total);
TextView orderStatus = view.findViewById(R.id.order_status);
TextView orderPhone = view.findViewById(R.id.order_phone);
TextView orderAddress = view.findViewById(R.id.order_address);
TextView orderName = view.findViewById(R.id.order_name);
TextView orderDateAndTime = view.findViewById(R.id.order_dateTime);
TextView orderFoods = view.findViewById(R.id.order_foods);
orderTotal.setText(orderTotalValue);
orderStatus.setText(convertCodeToStatus(dataOrderStatus));
orderPhone.setText(dataOrderPhone);
orderAddress.setText(dataOrderAddress);
orderName.setText(nameOfPerson);
orderDateAndTime.setText(dataDateAndTime.toString());
//what i must do to foods array when it comes and then finally is attached to the textview!
orderFoods.setText(foodsOrdered.toString());
}
}
You can create a model class (OrderData) with this parameters discount, price, productId, productName, quantity and replace in ActualFoodRequest class
private List<String> foods; //list of food orders
with this
private List<OrderData> foods;

Issue getting firebase to recyclerview android. No data showing up

I am unable to have my Firebase data show up in my RecyclerView. I am able to add data from my other activities to my Firebase Database, I am just having problems seeing the data in my RecyclerView.
I have created a FriebaseRecyclerAdapter that takes Recipe.class and my RecipeViewHolder. My ViewHolder takes three parts if my class (name, rating, and description). I am not receiving any helpful errors in Logcat.
RecipeList.class
public class RecipeList extends AppCompatActivity {
private RecyclerView recipes;
private FloatingActionButton newRecipeBtn;
private DatabaseReference mRecipeDatabase;
private RecyclerView.LayoutManager mLayoutManager;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recipe_list);
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
mRecipeDatabase = FirebaseDatabase.getInstance().getReference("Recipes");
newRecipeBtn = findViewById(R.id.fab);
recipes = findViewById(R.id.recyclerView);
recipes.setHasFixedSize(true);
mLayoutManager = new LinearLayoutManager(this);
recipes.setLayoutManager(mLayoutManager);
recipes.setItemAnimator(new DefaultItemAnimator());
recipes.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
FirebaseRecyclerAdapter<Recipe, RecipeViewHolder> adapter = new FirebaseRecyclerAdapter<Recipe, RecipeViewHolder>(
Recipe.class,
R.layout.recycler_list_item,
RecipeViewHolder.class,
mRecipeDatabase
) {
#Override
protected void populateViewHolder(RecipeViewHolder viewHolder, Recipe model, int position) {
viewHolder.setName(model.getName());
viewHolder.setRating(model.getRating());
viewHolder.setDescription(model.getDescription());
}
};
recipes.setAdapter(adapter);
}
public void toRecipeAdd(View view){
Intent intent = new Intent(RecipeList.this, RecipeAdd.class);
startActivity(intent);
}
public static class RecipeViewHolder extends RecyclerView.ViewHolder{
TextView text_name, text_rating, text_description;
public RecipeViewHolder(View itemView){
super(itemView);
text_name = itemView.findViewById(R.id.recipeNameTextView);
text_rating = itemView.findViewById(R.id.recipeRatingTextView);
text_description = itemView.findViewById(R.id.recipeDescriptionTextView);
}
public void setName(String name){
text_name.setText(name);
}
public void setRating(String rating){
text_rating.setText(rating);
}
public void setDescription(String description){
text_description.setText(description);
}
}
}
Recipe.Class
public class Recipe {
public String name;
public String url;
public String rating;
public String description;
public String id;
public String ingredients, instruction;
public Recipe(){}
public Recipe(String id, String name, String url, String rating, String description,
String ingredients, String instruction) {
this.id = id;
this.name = name;
this.url = url;
this.rating = rating;
this.description = description;
this.ingredients = ingredients;
this.instruction = instruction;
}
public Recipe(String name, String rating, String description){
this.name = name;
this.rating = rating;
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getRating() {
return rating;
}
public void setRating(String rating) {
this.rating = rating;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getIngredients() {
return ingredients;
}
public void setIngredients(String ingredients) {
this.ingredients = ingredients;
}
public String getInstruction() {
return instruction;
}
public void setInstruction(String instruction) {
this.instruction = instruction;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
Remove the following for the data to appear:
recipes.setHasFixedSize(true);
Refer to this:
https://github.com/firebase/FirebaseUI-Android/issues/204

Pass data from activity to dialogFragment in android

This is the method that I send the data from activity to dialog fragment
MultipleColorFragment multipleColorFragment = new MultipleColorFragment();//Get Fragment Instance
Bundle data = new Bundle();//Use bundle to pass data
for(int i = 0;i<product_data_two.getColor().size();i++) {
data.putStringArrayList(i + "", product_data_two.getColor().get(i));
Log.d(TAG + " send fragment data",data.toString());
}
data.putInt("size", product_data_two.getColor().size());
multipleColorFragment.setArguments(data);//Finally set argument bundle to fragment
final FragmentManager fm=getFragmentManager();
multipleColorFragment.show(fm,"Color Set");
This is the method that I get back the data.
RecyclerView rv;
ArrayList<ArrayList<String>> getArgument;
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.multiple_color_fragment_layout, container);
//RECYCER
rv = (RecyclerView) rootView.findViewById(R.id.multiple_color_recyclerview);
rv.setLayoutManager(new LinearLayoutManager(this.getActivity()));
rv.setLayoutManager(new GridLayoutManager(getActivity(), 6));
rv.setAdapter(new MultipleColorAdapter());
int size = getArguments().getInt("size");
Log.d( " size : " + size ,"");
for (int i = 0; i < size; i++)
getArgument.add(getArguments().getStringArrayList(i + ""));
this.getDialog().setTitle("Color Set");
return rootView;
}
I find that the data that I pass is right. However, I cannot get back the data in the fragment. Can anyoun help me to figure out the problem? Thank you very much.
Update:
ProductTypeTwo.java
public class ProductTypeTwo {
private String productName;
private String brandID;
private String description;
private String productImage;
private Long colorNo;
private String category;
private String uid;
private ArrayList<ArrayList<String>> color;
public ProductTypeTwo(String productName, String brandID, String description, String productImage, Long colorNo, String category, String uid, ArrayList<ArrayList<String>> color) {
this.productName = productName;
this.brandID = brandID;
this.description = description;
this.productImage = productImage;
this.colorNo = colorNo;
this.category = category;
this.uid = uid;
this.color = color;
}
public ProductTypeTwo()
{
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getBrandID() {
return brandID;
}
public void setBrandID(String brandID) {
this.brandID = brandID;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getProductImage() {
return productImage;
}
public void setProductImage(String productImage) {
this.productImage = productImage;
}
public Long getColorNo() {
return colorNo;
}
public void setColorNo(Long colorNo) {
this.colorNo = colorNo;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public ArrayList<ArrayList<String>> getColor() {
return color;
}
public void setColor(ArrayList<ArrayList<String>> color) {
this.color = color;
}
}
message from my logcat:
D/MultipleColorFragment color set size: 0
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean > > java.util.ArrayList.add(java.lang.Object)' on a null object reference
Since product_data_two.getColor() returns an ArrayList<ArrayList<String>> , you can add it to bundle like this:
bundle.putSerializable("SOME_KEY",product_data_two.getColor());
And in your Fragment, get it like this:
getArgument = (ArrayList<ArrayList<String>>) bundle.getSerializable("SOME_KEY");
read more: Bundle
First of all add you colors in a separate ArrayList and then put it all to the bundle to be passed to the Fragment
MultipleColorFragment multipleColorFragment = new
MultipleColorFragment();//Get Fragment Instance
Bundle data = new Bundle();//Use bundle to pass data
ArrayList<String> colorArray = new ArrayList<>()
for(int i = 0; i<product_data_two.getColor().size(); i++) {
colorArray.add(product_data_two.getColor().get(i));
}
data.putStringArrayList("colorArray", colorArray);
data.putInt("size", product_data_two.getColor().size());
multipleColorFragment.setArguments(data);//Finally set argument bundle to fragment
final FragmentManager fm=getFragmentManager();
multipleColorFragment.show(fm,"Color Set");
And in your Fragment get the whole ArrayList by key Like below
ArrayList<String> colorArray =getArguments().getStringArrayList("colorArray");

Categories

Resources