Passing data between child fragment to Parent Fragment or activityHow do I pass data between Activities in Android application?Passing data between a fragment and its container activityWhy fragments, and when to use fragments instead of activities?Fragment MyFragment not attached to ActivityCall an activity method from a fragmentSend data from activity to fragment in AndroidDilemma: when to use Fragments vs Activities:getFragmentManager returning null pointer exceptionupdating a fragment from activity during runtime, view variable not globalHow to parse jsonarray to listview in fragment
How long would it take to cross the Channel in 1890's?
What was the Shuttle Carrier Aircraft escape tunnel?
Cascading Repair Costs following Blown Head Gasket on a 2004 Subaru Outback
How to make clear to people I don't want to answer their "Where are you from?" question?
How risky is real estate?
How does this circuit work? (AM receiver)
Hot coffee brewing solutions for deep woods camping
Tantum religio potuit suadere malorum – Lucretius
Interaction between Leyline of Anticipation and Teferi, Time Raveler
Can we put equal sign after aggregate functions in sql?
Trainee keeps missing deadlines for independent learning
Suggested order for Amazon Prime Doctor Who series
How to get cool night-vision without lame drawbacks?
Require advice on power conservation for backpacking trip
3D Crossword, Cryptic, Statue View & Maze
expiry or manufactured date?
Find the diameter of a word graph
How dangerous are set-size assumptions?
Accidentals and ties
Did Karl Marx ever use any example that involved cotton and dollars to illustrate the way capital and surplus value were generated?
How does metta sutra develop loving kindness
How is hair tissue mineral analysis performed?
Can humans ever directly see a few photons at a time? Can a human see a single photon?
How do I set an alias to a terminal line?
Passing data between child fragment to Parent Fragment or activity
How do I pass data between Activities in Android application?Passing data between a fragment and its container activityWhy fragments, and when to use fragments instead of activities?Fragment MyFragment not attached to ActivityCall an activity method from a fragmentSend data from activity to fragment in AndroidDilemma: when to use Fragments vs Activities:getFragmentManager returning null pointer exceptionupdating a fragment from activity during runtime, view variable not globalHow to parse jsonarray to listview in fragment
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have 2 fragment one is my parent fragment inside i have one child fragment and i want to pass my both fragment data to activity i have declare interface for that communication but
getting null response every time i have problem to assign interface method value in fragment because i have declare in
on create ().
i have send date of multiple edit text value and spinner value when activity button click.
public class AddSubQuestion extends Fragment implements AdapterView.OnItemSelectedListener
private TextView addNewQuestxt;
private AppCompatSpinner choiceSpinner;
private String[] choiceList = "Single Choice", "Multiple Choice", "Multi-Line Text";
private RelativeLayout relativeSpinner, relativeLayoutSingleChoice, relativeLayoutMultipleChoice, relativeLayoutMultiLinesChoice;
private EditText questionTxt1, answerTxt1, answerTxt1_multiple, answerTxt2_multiple, answerTxt3_multiple, answerTxt4_multiple, answerTxt1_multiline;
private TextView addNewSubSingle, addNewSubMultiple, addNewSubMultiline;
private String questTxt, ansSingleTxt, ansMultipleTxt1, ansMultipleTxt2, ansMultipleTxt3, ansMultipleTxt4, ansMultilineTxt1;
private static final String TAG = AddSubQuestion.class.getSimpleName();
/* public static Object newInstance()
return null;
*/
@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
public AddSubQuestion()
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.activity_add_sub_new_question, container, false);
addNewQuestxt = view.findViewById(R.id.plus_btn);
relativeSpinner = view.findViewById(R.id.spinner_relative);
relativeLayoutSingleChoice = view.findViewById(R.id.singlechoice_relative);
relativeLayoutMultipleChoice = view.findViewById(R.id.multiplechoice_relative);
relativeLayoutMultiLinesChoice = view.findViewById(R.id.multilinechoice_relative);
questionTxt1 = view.findViewById(R.id.question_edit1);
//single choice
answerTxt1 = view.findViewById(R.id.answer_edit1);
addNewSubSingle = view.findViewById(R.id.plus_btn_singlechoice);
//multiple choice
answerTxt1_multiple = view.findViewById(R.id.answer_edit11);
answerTxt2_multiple = view.findViewById(R.id.answer_edit22);
answerTxt3_multiple = view.findViewById(R.id.answer_edit33);
answerTxt4_multiple = view.findViewById(R.id.answer_edit44);
addNewSubMultiple = view.findViewById(R.id.plus_btn_multiple);
//mutilines choice
answerTxt1_multiline = view.findViewById(R.id.answer_edit111);
addNewSubMultiline = view.findViewById(R.id.plus_btn_multiline);
choiceSpinner = view.findViewById(R.id.choice_spinner);
choiceSpinner.setOnItemSelectedListener(this);
//Creating the ArrayAdapter instance having the country list
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_spinner_item, choiceList);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//Setting the ArrayAdapter data on the Spinner
choiceSpinner.setAdapter(spinnerAdapter);
return view;
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
Toast.makeText(getActivity(), choiceList[position], Toast.LENGTH_LONG).show();
if (choiceList[position].equalsIgnoreCase("Multiple Choice"))
Log.d(TAG, "onItemSelected: multiple choice :");
relativeLayoutSingleChoice.setVisibility(View.GONE);
relativeLayoutMultiLinesChoice.setVisibility(View.GONE);
relativeLayoutMultipleChoice.setVisibility(View.VISIBLE);
else if (choiceList[position].equalsIgnoreCase("Multi-Line Text"))
Log.d(TAG, "onItemSelected: multi line text");
relativeLayoutMultipleChoice.setVisibility(View.GONE);
relativeLayoutSingleChoice.setVisibility(View.GONE);
relativeLayoutMultiLinesChoice.setVisibility(View.VISIBLE);
else
relativeLayoutSingleChoice.setVisibility(View.VISIBLE);
relativeLayoutMultiLinesChoice.setVisibility(View.GONE);
relativeLayoutMultipleChoice.setVisibility(View.GONE);
public MultipleChoiceQuesData getMultipleText()
MultipleChoiceQuesData questionData = new MultipleChoiceQuesData();
questionData.setChoice(choiceSpinner.getSelectedItem().toString());
questionData.setQuestion(questionTxt1.getText().toString());
questionData.setAnswer(answerTxt1_multiple.getText().toString().trim());
questionData.setAnswer2(answerTxt2_multiple.getText().toString().trim());
questionData.setAnswer3(answerTxt3_multiple.getText().toString().trim());
questionData.setAnswer4(answerTxt4_multiple.getText().toString().trim());
//return questionData;
return questionData;
public String getChoice()
return choiceSpinner.getSelectedItem().toString();
public MultilinesChoiceQueData getMultilinesText()
MultilinesChoiceQueData multilinesChoiceQueData = new MultilinesChoiceQueData();
multilinesChoiceQueData.setChoice(choiceSpinner.getSelectedItem().toString());
multilinesChoiceQueData.setQuestion(questionTxt1.getText().toString().trim());
multilinesChoiceQueData.setAnswer(answerTxt1_multiple.getText().toString().trim());
return multilinesChoiceQueData;
public SingleChoiceQuesData getSingleChoiceText()
SingleChoiceQuesData singleChoiceQuesData = new SingleChoiceQuesData();
singleChoiceQuesData.setChoice(choiceSpinner.getSelectedItem().toString());
singleChoiceQuesData.setQuestion(questionTxt1.getText().toString().trim());
singleChoiceQuesData.setAnswer(answerTxt1.getText().toString().trim());
return singleChoiceQuesData;
@Override
public void onNothingSelected(AdapterView<?> parent)
public interface OnChildDataPass
public void onChildDataPass(String data);
here is my child fragment
android android-fragments fragment
add a comment |
I have 2 fragment one is my parent fragment inside i have one child fragment and i want to pass my both fragment data to activity i have declare interface for that communication but
getting null response every time i have problem to assign interface method value in fragment because i have declare in
on create ().
i have send date of multiple edit text value and spinner value when activity button click.
public class AddSubQuestion extends Fragment implements AdapterView.OnItemSelectedListener
private TextView addNewQuestxt;
private AppCompatSpinner choiceSpinner;
private String[] choiceList = "Single Choice", "Multiple Choice", "Multi-Line Text";
private RelativeLayout relativeSpinner, relativeLayoutSingleChoice, relativeLayoutMultipleChoice, relativeLayoutMultiLinesChoice;
private EditText questionTxt1, answerTxt1, answerTxt1_multiple, answerTxt2_multiple, answerTxt3_multiple, answerTxt4_multiple, answerTxt1_multiline;
private TextView addNewSubSingle, addNewSubMultiple, addNewSubMultiline;
private String questTxt, ansSingleTxt, ansMultipleTxt1, ansMultipleTxt2, ansMultipleTxt3, ansMultipleTxt4, ansMultilineTxt1;
private static final String TAG = AddSubQuestion.class.getSimpleName();
/* public static Object newInstance()
return null;
*/
@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
public AddSubQuestion()
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.activity_add_sub_new_question, container, false);
addNewQuestxt = view.findViewById(R.id.plus_btn);
relativeSpinner = view.findViewById(R.id.spinner_relative);
relativeLayoutSingleChoice = view.findViewById(R.id.singlechoice_relative);
relativeLayoutMultipleChoice = view.findViewById(R.id.multiplechoice_relative);
relativeLayoutMultiLinesChoice = view.findViewById(R.id.multilinechoice_relative);
questionTxt1 = view.findViewById(R.id.question_edit1);
//single choice
answerTxt1 = view.findViewById(R.id.answer_edit1);
addNewSubSingle = view.findViewById(R.id.plus_btn_singlechoice);
//multiple choice
answerTxt1_multiple = view.findViewById(R.id.answer_edit11);
answerTxt2_multiple = view.findViewById(R.id.answer_edit22);
answerTxt3_multiple = view.findViewById(R.id.answer_edit33);
answerTxt4_multiple = view.findViewById(R.id.answer_edit44);
addNewSubMultiple = view.findViewById(R.id.plus_btn_multiple);
//mutilines choice
answerTxt1_multiline = view.findViewById(R.id.answer_edit111);
addNewSubMultiline = view.findViewById(R.id.plus_btn_multiline);
choiceSpinner = view.findViewById(R.id.choice_spinner);
choiceSpinner.setOnItemSelectedListener(this);
//Creating the ArrayAdapter instance having the country list
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_spinner_item, choiceList);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//Setting the ArrayAdapter data on the Spinner
choiceSpinner.setAdapter(spinnerAdapter);
return view;
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
Toast.makeText(getActivity(), choiceList[position], Toast.LENGTH_LONG).show();
if (choiceList[position].equalsIgnoreCase("Multiple Choice"))
Log.d(TAG, "onItemSelected: multiple choice :");
relativeLayoutSingleChoice.setVisibility(View.GONE);
relativeLayoutMultiLinesChoice.setVisibility(View.GONE);
relativeLayoutMultipleChoice.setVisibility(View.VISIBLE);
else if (choiceList[position].equalsIgnoreCase("Multi-Line Text"))
Log.d(TAG, "onItemSelected: multi line text");
relativeLayoutMultipleChoice.setVisibility(View.GONE);
relativeLayoutSingleChoice.setVisibility(View.GONE);
relativeLayoutMultiLinesChoice.setVisibility(View.VISIBLE);
else
relativeLayoutSingleChoice.setVisibility(View.VISIBLE);
relativeLayoutMultiLinesChoice.setVisibility(View.GONE);
relativeLayoutMultipleChoice.setVisibility(View.GONE);
public MultipleChoiceQuesData getMultipleText()
MultipleChoiceQuesData questionData = new MultipleChoiceQuesData();
questionData.setChoice(choiceSpinner.getSelectedItem().toString());
questionData.setQuestion(questionTxt1.getText().toString());
questionData.setAnswer(answerTxt1_multiple.getText().toString().trim());
questionData.setAnswer2(answerTxt2_multiple.getText().toString().trim());
questionData.setAnswer3(answerTxt3_multiple.getText().toString().trim());
questionData.setAnswer4(answerTxt4_multiple.getText().toString().trim());
//return questionData;
return questionData;
public String getChoice()
return choiceSpinner.getSelectedItem().toString();
public MultilinesChoiceQueData getMultilinesText()
MultilinesChoiceQueData multilinesChoiceQueData = new MultilinesChoiceQueData();
multilinesChoiceQueData.setChoice(choiceSpinner.getSelectedItem().toString());
multilinesChoiceQueData.setQuestion(questionTxt1.getText().toString().trim());
multilinesChoiceQueData.setAnswer(answerTxt1_multiple.getText().toString().trim());
return multilinesChoiceQueData;
public SingleChoiceQuesData getSingleChoiceText()
SingleChoiceQuesData singleChoiceQuesData = new SingleChoiceQuesData();
singleChoiceQuesData.setChoice(choiceSpinner.getSelectedItem().toString());
singleChoiceQuesData.setQuestion(questionTxt1.getText().toString().trim());
singleChoiceQuesData.setAnswer(answerTxt1.getText().toString().trim());
return singleChoiceQuesData;
@Override
public void onNothingSelected(AdapterView<?> parent)
public interface OnChildDataPass
public void onChildDataPass(String data);
here is my child fragment
android android-fragments fragment
add a comment |
I have 2 fragment one is my parent fragment inside i have one child fragment and i want to pass my both fragment data to activity i have declare interface for that communication but
getting null response every time i have problem to assign interface method value in fragment because i have declare in
on create ().
i have send date of multiple edit text value and spinner value when activity button click.
public class AddSubQuestion extends Fragment implements AdapterView.OnItemSelectedListener
private TextView addNewQuestxt;
private AppCompatSpinner choiceSpinner;
private String[] choiceList = "Single Choice", "Multiple Choice", "Multi-Line Text";
private RelativeLayout relativeSpinner, relativeLayoutSingleChoice, relativeLayoutMultipleChoice, relativeLayoutMultiLinesChoice;
private EditText questionTxt1, answerTxt1, answerTxt1_multiple, answerTxt2_multiple, answerTxt3_multiple, answerTxt4_multiple, answerTxt1_multiline;
private TextView addNewSubSingle, addNewSubMultiple, addNewSubMultiline;
private String questTxt, ansSingleTxt, ansMultipleTxt1, ansMultipleTxt2, ansMultipleTxt3, ansMultipleTxt4, ansMultilineTxt1;
private static final String TAG = AddSubQuestion.class.getSimpleName();
/* public static Object newInstance()
return null;
*/
@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
public AddSubQuestion()
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.activity_add_sub_new_question, container, false);
addNewQuestxt = view.findViewById(R.id.plus_btn);
relativeSpinner = view.findViewById(R.id.spinner_relative);
relativeLayoutSingleChoice = view.findViewById(R.id.singlechoice_relative);
relativeLayoutMultipleChoice = view.findViewById(R.id.multiplechoice_relative);
relativeLayoutMultiLinesChoice = view.findViewById(R.id.multilinechoice_relative);
questionTxt1 = view.findViewById(R.id.question_edit1);
//single choice
answerTxt1 = view.findViewById(R.id.answer_edit1);
addNewSubSingle = view.findViewById(R.id.plus_btn_singlechoice);
//multiple choice
answerTxt1_multiple = view.findViewById(R.id.answer_edit11);
answerTxt2_multiple = view.findViewById(R.id.answer_edit22);
answerTxt3_multiple = view.findViewById(R.id.answer_edit33);
answerTxt4_multiple = view.findViewById(R.id.answer_edit44);
addNewSubMultiple = view.findViewById(R.id.plus_btn_multiple);
//mutilines choice
answerTxt1_multiline = view.findViewById(R.id.answer_edit111);
addNewSubMultiline = view.findViewById(R.id.plus_btn_multiline);
choiceSpinner = view.findViewById(R.id.choice_spinner);
choiceSpinner.setOnItemSelectedListener(this);
//Creating the ArrayAdapter instance having the country list
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_spinner_item, choiceList);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//Setting the ArrayAdapter data on the Spinner
choiceSpinner.setAdapter(spinnerAdapter);
return view;
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
Toast.makeText(getActivity(), choiceList[position], Toast.LENGTH_LONG).show();
if (choiceList[position].equalsIgnoreCase("Multiple Choice"))
Log.d(TAG, "onItemSelected: multiple choice :");
relativeLayoutSingleChoice.setVisibility(View.GONE);
relativeLayoutMultiLinesChoice.setVisibility(View.GONE);
relativeLayoutMultipleChoice.setVisibility(View.VISIBLE);
else if (choiceList[position].equalsIgnoreCase("Multi-Line Text"))
Log.d(TAG, "onItemSelected: multi line text");
relativeLayoutMultipleChoice.setVisibility(View.GONE);
relativeLayoutSingleChoice.setVisibility(View.GONE);
relativeLayoutMultiLinesChoice.setVisibility(View.VISIBLE);
else
relativeLayoutSingleChoice.setVisibility(View.VISIBLE);
relativeLayoutMultiLinesChoice.setVisibility(View.GONE);
relativeLayoutMultipleChoice.setVisibility(View.GONE);
public MultipleChoiceQuesData getMultipleText()
MultipleChoiceQuesData questionData = new MultipleChoiceQuesData();
questionData.setChoice(choiceSpinner.getSelectedItem().toString());
questionData.setQuestion(questionTxt1.getText().toString());
questionData.setAnswer(answerTxt1_multiple.getText().toString().trim());
questionData.setAnswer2(answerTxt2_multiple.getText().toString().trim());
questionData.setAnswer3(answerTxt3_multiple.getText().toString().trim());
questionData.setAnswer4(answerTxt4_multiple.getText().toString().trim());
//return questionData;
return questionData;
public String getChoice()
return choiceSpinner.getSelectedItem().toString();
public MultilinesChoiceQueData getMultilinesText()
MultilinesChoiceQueData multilinesChoiceQueData = new MultilinesChoiceQueData();
multilinesChoiceQueData.setChoice(choiceSpinner.getSelectedItem().toString());
multilinesChoiceQueData.setQuestion(questionTxt1.getText().toString().trim());
multilinesChoiceQueData.setAnswer(answerTxt1_multiple.getText().toString().trim());
return multilinesChoiceQueData;
public SingleChoiceQuesData getSingleChoiceText()
SingleChoiceQuesData singleChoiceQuesData = new SingleChoiceQuesData();
singleChoiceQuesData.setChoice(choiceSpinner.getSelectedItem().toString());
singleChoiceQuesData.setQuestion(questionTxt1.getText().toString().trim());
singleChoiceQuesData.setAnswer(answerTxt1.getText().toString().trim());
return singleChoiceQuesData;
@Override
public void onNothingSelected(AdapterView<?> parent)
public interface OnChildDataPass
public void onChildDataPass(String data);
here is my child fragment
android android-fragments fragment
I have 2 fragment one is my parent fragment inside i have one child fragment and i want to pass my both fragment data to activity i have declare interface for that communication but
getting null response every time i have problem to assign interface method value in fragment because i have declare in
on create ().
i have send date of multiple edit text value and spinner value when activity button click.
public class AddSubQuestion extends Fragment implements AdapterView.OnItemSelectedListener
private TextView addNewQuestxt;
private AppCompatSpinner choiceSpinner;
private String[] choiceList = "Single Choice", "Multiple Choice", "Multi-Line Text";
private RelativeLayout relativeSpinner, relativeLayoutSingleChoice, relativeLayoutMultipleChoice, relativeLayoutMultiLinesChoice;
private EditText questionTxt1, answerTxt1, answerTxt1_multiple, answerTxt2_multiple, answerTxt3_multiple, answerTxt4_multiple, answerTxt1_multiline;
private TextView addNewSubSingle, addNewSubMultiple, addNewSubMultiline;
private String questTxt, ansSingleTxt, ansMultipleTxt1, ansMultipleTxt2, ansMultipleTxt3, ansMultipleTxt4, ansMultilineTxt1;
private static final String TAG = AddSubQuestion.class.getSimpleName();
/* public static Object newInstance()
return null;
*/
@Override
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
public AddSubQuestion()
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.activity_add_sub_new_question, container, false);
addNewQuestxt = view.findViewById(R.id.plus_btn);
relativeSpinner = view.findViewById(R.id.spinner_relative);
relativeLayoutSingleChoice = view.findViewById(R.id.singlechoice_relative);
relativeLayoutMultipleChoice = view.findViewById(R.id.multiplechoice_relative);
relativeLayoutMultiLinesChoice = view.findViewById(R.id.multilinechoice_relative);
questionTxt1 = view.findViewById(R.id.question_edit1);
//single choice
answerTxt1 = view.findViewById(R.id.answer_edit1);
addNewSubSingle = view.findViewById(R.id.plus_btn_singlechoice);
//multiple choice
answerTxt1_multiple = view.findViewById(R.id.answer_edit11);
answerTxt2_multiple = view.findViewById(R.id.answer_edit22);
answerTxt3_multiple = view.findViewById(R.id.answer_edit33);
answerTxt4_multiple = view.findViewById(R.id.answer_edit44);
addNewSubMultiple = view.findViewById(R.id.plus_btn_multiple);
//mutilines choice
answerTxt1_multiline = view.findViewById(R.id.answer_edit111);
addNewSubMultiline = view.findViewById(R.id.plus_btn_multiline);
choiceSpinner = view.findViewById(R.id.choice_spinner);
choiceSpinner.setOnItemSelectedListener(this);
//Creating the ArrayAdapter instance having the country list
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_spinner_item, choiceList);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//Setting the ArrayAdapter data on the Spinner
choiceSpinner.setAdapter(spinnerAdapter);
return view;
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
Toast.makeText(getActivity(), choiceList[position], Toast.LENGTH_LONG).show();
if (choiceList[position].equalsIgnoreCase("Multiple Choice"))
Log.d(TAG, "onItemSelected: multiple choice :");
relativeLayoutSingleChoice.setVisibility(View.GONE);
relativeLayoutMultiLinesChoice.setVisibility(View.GONE);
relativeLayoutMultipleChoice.setVisibility(View.VISIBLE);
else if (choiceList[position].equalsIgnoreCase("Multi-Line Text"))
Log.d(TAG, "onItemSelected: multi line text");
relativeLayoutMultipleChoice.setVisibility(View.GONE);
relativeLayoutSingleChoice.setVisibility(View.GONE);
relativeLayoutMultiLinesChoice.setVisibility(View.VISIBLE);
else
relativeLayoutSingleChoice.setVisibility(View.VISIBLE);
relativeLayoutMultiLinesChoice.setVisibility(View.GONE);
relativeLayoutMultipleChoice.setVisibility(View.GONE);
public MultipleChoiceQuesData getMultipleText()
MultipleChoiceQuesData questionData = new MultipleChoiceQuesData();
questionData.setChoice(choiceSpinner.getSelectedItem().toString());
questionData.setQuestion(questionTxt1.getText().toString());
questionData.setAnswer(answerTxt1_multiple.getText().toString().trim());
questionData.setAnswer2(answerTxt2_multiple.getText().toString().trim());
questionData.setAnswer3(answerTxt3_multiple.getText().toString().trim());
questionData.setAnswer4(answerTxt4_multiple.getText().toString().trim());
//return questionData;
return questionData;
public String getChoice()
return choiceSpinner.getSelectedItem().toString();
public MultilinesChoiceQueData getMultilinesText()
MultilinesChoiceQueData multilinesChoiceQueData = new MultilinesChoiceQueData();
multilinesChoiceQueData.setChoice(choiceSpinner.getSelectedItem().toString());
multilinesChoiceQueData.setQuestion(questionTxt1.getText().toString().trim());
multilinesChoiceQueData.setAnswer(answerTxt1_multiple.getText().toString().trim());
return multilinesChoiceQueData;
public SingleChoiceQuesData getSingleChoiceText()
SingleChoiceQuesData singleChoiceQuesData = new SingleChoiceQuesData();
singleChoiceQuesData.setChoice(choiceSpinner.getSelectedItem().toString());
singleChoiceQuesData.setQuestion(questionTxt1.getText().toString().trim());
singleChoiceQuesData.setAnswer(answerTxt1.getText().toString().trim());
return singleChoiceQuesData;
@Override
public void onNothingSelected(AdapterView<?> parent)
public interface OnChildDataPass
public void onChildDataPass(String data);
here is my child fragment
android android-fragments fragment
android android-fragments fragment
asked Mar 25 at 9:27
Karishma PatelKarishma Patel
14510 bronze badges
14510 bronze badges
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55334716%2fpassing-data-between-child-fragment-to-parent-fragment-or-activity%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55334716%2fpassing-data-between-child-fragment-to-parent-fragment-or-activity%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown