public class RecyclerAdapterNew extends RecyclerView.Adapter<DataHolderNew> {
@Override
public DataHolderNew onCreateViewHolder(ViewGroup parent, int viewType) {
Context context = parent.getContext();
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.table_values, parent, false);
return new DataHolderNew(view);
}
@Override
public void onBindViewHolder(DataHolderNew holder, int position) {
Intent intent=new Intent();
intent.getExtras("transfer",);//i have to transfer the value of the
//textview by converting into int and transfer into another class
holder.table_value.setText("table values: "+(position+1));
}
@Override
public int getItemCount() {
return 10;
}
}
Asked
Active
Viewed 208 times
-1

rafsanahmad007
- 23,683
- 6
- 47
- 62

hiashutoshsingh
- 980
- 2
- 14
- 41
-
1so what is your question actually? – pskink Jan 29 '17 at 08:36
-
i want to tranfer the nos. value to another class which is displayed by the recyclerview ...how should i do? @pskink – hiashutoshsingh Jan 29 '17 at 08:48
2 Answers
1
public class RecyclerAdapterNew extends RecyclerView.Adapter {
@Override
public DataHolderNew onCreateViewHolder(ViewGroup parent, int viewType) {
Context context = parent.getContext();
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.table_values, parent, false);
return new DataHolderNew(view);
}
@Override
public void onBindViewHolder(DataHolderNew holder, int position) {
Intent intent=new Intent();
int value = intent.getIntExtra("transfer",);
holder.table_value.setText("table values: "+(position+1)*value);
}
@Override
public int getItemCount() {
return 10;
}
}

hiashutoshsingh
- 980
- 2
- 14
- 41
0
You can use the following in the calling/invoking activity "-
Intent intent = new Intent(this,CalledActivity.class);
intent.putExtra(NameKeyforvalue,value); ......
startActivity(intent)
and use the following in Called/Invoked (receiving) activity :-
variabletoholdvalue = getIntent().getStringExtra(NameKeyforValue);
Note! getIntExtra, getLongExtra etc... (some require default, getStringExtra doesn't)

MikeT
- 51,415
- 16
- 49
- 68