I need the chapterId
and lessonId
value in Tablayout
fragments .
one of the solution to send data from activity to fragment is sending value with public method in activity and create a new instance in fragment and give the value in fragments .
I have This activity where i get bundle in that .
public class DetailActivity extends AppCompatActivity {
private String chapterId;
private String lessonId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
getBundle();
}
private void getBundle() {
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
chapterId = bundle.getString("CHAPTERID");
lessonId = bundle.getString("LESSONID");
}
}
======== Method for sending data to other Activities and Fragments=====
public String getId(){
}
}
Now my question is how can i write this method . Thanks