Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package app.listazakupow;
- import android.annotation.SuppressLint;
- import android.content.Intent;
- import android.os.Bundle;
- import android.support.v7.app.AppCompatActivity;
- import android.support.v7.widget.RecyclerView;
- import android.widget.TextView;
- import java.util.ArrayList;
- public class FinalListActivity extends AppCompatActivity {
- private ArrayList<String> finalListArrayList;
- private RecyclerView recyclerView;
- private TextView textView1, textView2, textView3;
- private MyAdapter myAdapter;
- @SuppressLint("WrongViewCast")
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.finallist_layout);
- Intent intent = getIntent();
- finalListArrayList = intent.getStringArrayListExtra("productList");
- recyclerView = (RecyclerView) findViewById(R.id.recycler_view1);
- //CustomAdapter adapter = new CustomAdapter<>(this, android.R.layout.simple_dropdown_item_1line, finalListArrayList);
- myAdapter = new MyAdapter(finalListArrayList);
- recyclerView.setAdapter(myAdapter);
- myAdapter.notifyDataSetChanged();
- textView1 = (TextView) findViewById(R.id.textView1);
- textView2 = (TextView) findViewById(R.id.textView2);
- textView3 = (TextView) findViewById(R.id.textView3);
- textView1.setText("Amount of products: " + finalListArrayList.size());
- }
- // private class CustomAdapter<String> extends ArrayAdapter<String>{
- // LinearLayout linearLayout;
- // TextView final_list_TextView1;
- // CheckBox checkBox;
- // private CustomAdapter(Context context, int resource, ArrayList<String> object){
- // super(context,resource,object);
- // }
- // @Override
- // public View getView(final int position, View view, final ViewGroup parentView){
- // if(view==null) {
- // view = LayoutInflater.from(getContext()).inflate(R.layout.finallist_list_layout, parentView, false);
- // }
- // linearLayout = (LinearLayout) view.findViewById(R.id.linearLayout1);
- // final_list_TextView1 = (TextView) view.findViewById(R.id.final_list_TextView1);
- // final_list_TextView1.setText(finalListArrayList.get(position));
- // checkBox = (CheckBox) view.findViewById(R.id.checkBox1);
- // checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- // @Override
- // public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- // if(isChecked){
- // parentView.getChildAt(position).setBackgroundColor(Color.rgb(0,225,0));
- // notifyDataSetChanged();
- // }
- // else{
- //
- // parentView.getChildAt(position).setBackgroundColor(Color.WHITE);
- // }
- // }
- // });
- // return view;
- // }
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement