A variabel on Method “onOptionsItemSelected” not update in Fragment












0















I have a fragment like the following, I know how to communicate between fragments by making parameters and attaching them to the Bundle argument. in this case the fragment will call a new fragment and will overwrite the old display fragment. Then i need to pass value between fragment to new fragment. When I press the share menu on Actionbar button I want the url share to match the current one Its works if i console it with log, but still old value



public class ReadingFragment extends Fragment implements
ReadFragView,
RelatedNewsAdapter.RelatedNewsCallback {

private static final String ARG_GUID = "ARG_GUID";
public static final String ARG_BOOKMARK = "ARG_BOOKMARK";
public static final String ARG_URLSHARE = "ARG_URLSHARE";

private Unbinder unbinder;

private String guidData;

private OnFragmentInteractionListener mListener;

private ReadFragPresenter readFragPresenter;

private FragmentManager fragmentManager;

private String urlForSharing;
private Bookmark bookmark;

public ReadingFragment() {
// Required empty public constructor
}

public static ReadingFragment newInstance(String guid, Bookmark bookmark, String urlShare) {
ReadingFragment fragment = new ReadingFragment();
Bundle args = new Bundle();
args.putString(ARG_GUID, guid);
if(bookmark != null){
args.putSerializable(ARG_BOOKMARK, bookmark);
}
if(urlShare != null){
// --- THIS LINE IS WORKING --- //
args.putString(ARG_URLSHARE, urlShare);
}
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
readFragPresenter = new ReadFragPresenterImpl(this, getActivity().getApplication());
if (getArguments() != null) {
guidData = getArguments().getString(ARG_GUID);
bookmark = (Bookmark) getArguments().getSerializable(ARG_BOOKMARK);
// --- THIS LINE IS WORKING TOO, VALUE URLFORSHARING IS CORRECT ---
urlForSharing = getArguments().getString(ARG_URLSHARE);
Timber.d("OnCreate urlShare %s", urlForSharing);

}
fragmentManager = getFragmentManager();
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
setRetainInstance(true);
setHasOptionsMenu(true);
return inflater.inflate(R.layout.fragment_reading, container, false);
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
inflater.inflate(R.menu.menu_reading, menu);
super.onCreateOptionsMenu(menu, inflater);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

int id = item.getItemId();
switch (id){
case R.id.share:
// ---THIS IS THE PROBLEM, THIS LINE IS STILL OLD VALUE --- //
Timber.d("urlSharing selected %s", urlForSharing);
// --- THIS IS THE PROBLEM -----//
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, ""+ DeviceUtil.getApplicationName(getContext()));
shareIntent.putExtra(Intent.EXTRA_TEXT, urlForSharing);
startActivity(Intent.createChooser(shareIntent, "Share Via"));
return true;

case R.id.bookmark:
Timber.d("select item %s", bookmark.toString());
return true;
}

return super.onOptionsItemSelected(item);
}

@Override
public void resultLoadSelectedNews(boolean isSuccess, MotherArticle motherArticle) {

if(isSuccess){
Article article = motherArticle.getArticles().get(0);
//RELATED NEWS
RelatedNewsAdapter relatedNewsAdapter = new RelatedNewsAdapter(getContext(),
motherArticle.getRelates(), this);
recycleRelatedNews.setLayoutManager(new LinearLayoutManager(getContext()));
recycleRelatedNews.setAdapter(relatedNewsAdapter);

// FOR SHARING (FIRST OPENING)
urlForSharing = article.getMoreLink();

// FOR BOOKMARK (FIRST OPENING)
bookmark = new Bookmark();
bookmark.setTitle(article.getHeadLine());
Timber.d("isi bookmark -> %s", bookmark.toString());

}
progressBar.setVisibility(View.GONE);
}

@Override
public void itemClick(Related related) {

bookmark = new Bookmark();
bookmark.setTitle(related.getTitle());

// --- VALUE URLSHARE IS UPDATED HERE--//
String urlShare = related.getLink();
Timber.d("urlShared %s", urlShare);

ReadingFragment fragment = ReadingFragment.newInstance(related.getGuid(), bookmark, urlShare);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_right);
transaction.addToBackStack(null);
transaction.add(R.id.dynamic_fragment_frame, fragment, "FRAGMENT_"+related.getGuid());
transaction.commit();
}
}


the url on onOptionsItemSelected is still the old url, even though it should have been replaced by the new url the url above is still the old url, even though it should have been replaced by the new url which I have updated through the Bundle argument.










share|improve this question























  • urlForSharing is set from bundle for first time . Its only getting reset inside resultLoadSelectedNews . If resultLoadSelectedNews will never get called it won't reset . Solution is Debug your code see if resultLoadSelectedNews is getting called or not with isSuccess as true.

    – ADM
    Jan 2 at 4:08











  • resultLoadSelectedNews is called, i have console the value inside its correct as i expected. But the problem is urlForSharing is not replacing with new value after calling new fragment

    – Nanda Z
    Jan 2 at 4:40













  • That can only means Either ` urlForSharing = article.getMoreLink();` returning the same link OR your Fragment gets recreated some how .

    – ADM
    Jan 2 at 4:47











  • I just confirmed it again, the value of urlForSharing in the resultLoadSelectedNews is the update value. This value is what I need

    – Nanda Z
    Jan 2 at 4:57


















0















I have a fragment like the following, I know how to communicate between fragments by making parameters and attaching them to the Bundle argument. in this case the fragment will call a new fragment and will overwrite the old display fragment. Then i need to pass value between fragment to new fragment. When I press the share menu on Actionbar button I want the url share to match the current one Its works if i console it with log, but still old value



public class ReadingFragment extends Fragment implements
ReadFragView,
RelatedNewsAdapter.RelatedNewsCallback {

private static final String ARG_GUID = "ARG_GUID";
public static final String ARG_BOOKMARK = "ARG_BOOKMARK";
public static final String ARG_URLSHARE = "ARG_URLSHARE";

private Unbinder unbinder;

private String guidData;

private OnFragmentInteractionListener mListener;

private ReadFragPresenter readFragPresenter;

private FragmentManager fragmentManager;

private String urlForSharing;
private Bookmark bookmark;

public ReadingFragment() {
// Required empty public constructor
}

public static ReadingFragment newInstance(String guid, Bookmark bookmark, String urlShare) {
ReadingFragment fragment = new ReadingFragment();
Bundle args = new Bundle();
args.putString(ARG_GUID, guid);
if(bookmark != null){
args.putSerializable(ARG_BOOKMARK, bookmark);
}
if(urlShare != null){
// --- THIS LINE IS WORKING --- //
args.putString(ARG_URLSHARE, urlShare);
}
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
readFragPresenter = new ReadFragPresenterImpl(this, getActivity().getApplication());
if (getArguments() != null) {
guidData = getArguments().getString(ARG_GUID);
bookmark = (Bookmark) getArguments().getSerializable(ARG_BOOKMARK);
// --- THIS LINE IS WORKING TOO, VALUE URLFORSHARING IS CORRECT ---
urlForSharing = getArguments().getString(ARG_URLSHARE);
Timber.d("OnCreate urlShare %s", urlForSharing);

}
fragmentManager = getFragmentManager();
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
setRetainInstance(true);
setHasOptionsMenu(true);
return inflater.inflate(R.layout.fragment_reading, container, false);
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
inflater.inflate(R.menu.menu_reading, menu);
super.onCreateOptionsMenu(menu, inflater);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

int id = item.getItemId();
switch (id){
case R.id.share:
// ---THIS IS THE PROBLEM, THIS LINE IS STILL OLD VALUE --- //
Timber.d("urlSharing selected %s", urlForSharing);
// --- THIS IS THE PROBLEM -----//
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, ""+ DeviceUtil.getApplicationName(getContext()));
shareIntent.putExtra(Intent.EXTRA_TEXT, urlForSharing);
startActivity(Intent.createChooser(shareIntent, "Share Via"));
return true;

case R.id.bookmark:
Timber.d("select item %s", bookmark.toString());
return true;
}

return super.onOptionsItemSelected(item);
}

@Override
public void resultLoadSelectedNews(boolean isSuccess, MotherArticle motherArticle) {

if(isSuccess){
Article article = motherArticle.getArticles().get(0);
//RELATED NEWS
RelatedNewsAdapter relatedNewsAdapter = new RelatedNewsAdapter(getContext(),
motherArticle.getRelates(), this);
recycleRelatedNews.setLayoutManager(new LinearLayoutManager(getContext()));
recycleRelatedNews.setAdapter(relatedNewsAdapter);

// FOR SHARING (FIRST OPENING)
urlForSharing = article.getMoreLink();

// FOR BOOKMARK (FIRST OPENING)
bookmark = new Bookmark();
bookmark.setTitle(article.getHeadLine());
Timber.d("isi bookmark -> %s", bookmark.toString());

}
progressBar.setVisibility(View.GONE);
}

@Override
public void itemClick(Related related) {

bookmark = new Bookmark();
bookmark.setTitle(related.getTitle());

// --- VALUE URLSHARE IS UPDATED HERE--//
String urlShare = related.getLink();
Timber.d("urlShared %s", urlShare);

ReadingFragment fragment = ReadingFragment.newInstance(related.getGuid(), bookmark, urlShare);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_right);
transaction.addToBackStack(null);
transaction.add(R.id.dynamic_fragment_frame, fragment, "FRAGMENT_"+related.getGuid());
transaction.commit();
}
}


the url on onOptionsItemSelected is still the old url, even though it should have been replaced by the new url the url above is still the old url, even though it should have been replaced by the new url which I have updated through the Bundle argument.










share|improve this question























  • urlForSharing is set from bundle for first time . Its only getting reset inside resultLoadSelectedNews . If resultLoadSelectedNews will never get called it won't reset . Solution is Debug your code see if resultLoadSelectedNews is getting called or not with isSuccess as true.

    – ADM
    Jan 2 at 4:08











  • resultLoadSelectedNews is called, i have console the value inside its correct as i expected. But the problem is urlForSharing is not replacing with new value after calling new fragment

    – Nanda Z
    Jan 2 at 4:40













  • That can only means Either ` urlForSharing = article.getMoreLink();` returning the same link OR your Fragment gets recreated some how .

    – ADM
    Jan 2 at 4:47











  • I just confirmed it again, the value of urlForSharing in the resultLoadSelectedNews is the update value. This value is what I need

    – Nanda Z
    Jan 2 at 4:57
















0












0








0








I have a fragment like the following, I know how to communicate between fragments by making parameters and attaching them to the Bundle argument. in this case the fragment will call a new fragment and will overwrite the old display fragment. Then i need to pass value between fragment to new fragment. When I press the share menu on Actionbar button I want the url share to match the current one Its works if i console it with log, but still old value



public class ReadingFragment extends Fragment implements
ReadFragView,
RelatedNewsAdapter.RelatedNewsCallback {

private static final String ARG_GUID = "ARG_GUID";
public static final String ARG_BOOKMARK = "ARG_BOOKMARK";
public static final String ARG_URLSHARE = "ARG_URLSHARE";

private Unbinder unbinder;

private String guidData;

private OnFragmentInteractionListener mListener;

private ReadFragPresenter readFragPresenter;

private FragmentManager fragmentManager;

private String urlForSharing;
private Bookmark bookmark;

public ReadingFragment() {
// Required empty public constructor
}

public static ReadingFragment newInstance(String guid, Bookmark bookmark, String urlShare) {
ReadingFragment fragment = new ReadingFragment();
Bundle args = new Bundle();
args.putString(ARG_GUID, guid);
if(bookmark != null){
args.putSerializable(ARG_BOOKMARK, bookmark);
}
if(urlShare != null){
// --- THIS LINE IS WORKING --- //
args.putString(ARG_URLSHARE, urlShare);
}
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
readFragPresenter = new ReadFragPresenterImpl(this, getActivity().getApplication());
if (getArguments() != null) {
guidData = getArguments().getString(ARG_GUID);
bookmark = (Bookmark) getArguments().getSerializable(ARG_BOOKMARK);
// --- THIS LINE IS WORKING TOO, VALUE URLFORSHARING IS CORRECT ---
urlForSharing = getArguments().getString(ARG_URLSHARE);
Timber.d("OnCreate urlShare %s", urlForSharing);

}
fragmentManager = getFragmentManager();
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
setRetainInstance(true);
setHasOptionsMenu(true);
return inflater.inflate(R.layout.fragment_reading, container, false);
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
inflater.inflate(R.menu.menu_reading, menu);
super.onCreateOptionsMenu(menu, inflater);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

int id = item.getItemId();
switch (id){
case R.id.share:
// ---THIS IS THE PROBLEM, THIS LINE IS STILL OLD VALUE --- //
Timber.d("urlSharing selected %s", urlForSharing);
// --- THIS IS THE PROBLEM -----//
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, ""+ DeviceUtil.getApplicationName(getContext()));
shareIntent.putExtra(Intent.EXTRA_TEXT, urlForSharing);
startActivity(Intent.createChooser(shareIntent, "Share Via"));
return true;

case R.id.bookmark:
Timber.d("select item %s", bookmark.toString());
return true;
}

return super.onOptionsItemSelected(item);
}

@Override
public void resultLoadSelectedNews(boolean isSuccess, MotherArticle motherArticle) {

if(isSuccess){
Article article = motherArticle.getArticles().get(0);
//RELATED NEWS
RelatedNewsAdapter relatedNewsAdapter = new RelatedNewsAdapter(getContext(),
motherArticle.getRelates(), this);
recycleRelatedNews.setLayoutManager(new LinearLayoutManager(getContext()));
recycleRelatedNews.setAdapter(relatedNewsAdapter);

// FOR SHARING (FIRST OPENING)
urlForSharing = article.getMoreLink();

// FOR BOOKMARK (FIRST OPENING)
bookmark = new Bookmark();
bookmark.setTitle(article.getHeadLine());
Timber.d("isi bookmark -> %s", bookmark.toString());

}
progressBar.setVisibility(View.GONE);
}

@Override
public void itemClick(Related related) {

bookmark = new Bookmark();
bookmark.setTitle(related.getTitle());

// --- VALUE URLSHARE IS UPDATED HERE--//
String urlShare = related.getLink();
Timber.d("urlShared %s", urlShare);

ReadingFragment fragment = ReadingFragment.newInstance(related.getGuid(), bookmark, urlShare);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_right);
transaction.addToBackStack(null);
transaction.add(R.id.dynamic_fragment_frame, fragment, "FRAGMENT_"+related.getGuid());
transaction.commit();
}
}


the url on onOptionsItemSelected is still the old url, even though it should have been replaced by the new url the url above is still the old url, even though it should have been replaced by the new url which I have updated through the Bundle argument.










share|improve this question














I have a fragment like the following, I know how to communicate between fragments by making parameters and attaching them to the Bundle argument. in this case the fragment will call a new fragment and will overwrite the old display fragment. Then i need to pass value between fragment to new fragment. When I press the share menu on Actionbar button I want the url share to match the current one Its works if i console it with log, but still old value



public class ReadingFragment extends Fragment implements
ReadFragView,
RelatedNewsAdapter.RelatedNewsCallback {

private static final String ARG_GUID = "ARG_GUID";
public static final String ARG_BOOKMARK = "ARG_BOOKMARK";
public static final String ARG_URLSHARE = "ARG_URLSHARE";

private Unbinder unbinder;

private String guidData;

private OnFragmentInteractionListener mListener;

private ReadFragPresenter readFragPresenter;

private FragmentManager fragmentManager;

private String urlForSharing;
private Bookmark bookmark;

public ReadingFragment() {
// Required empty public constructor
}

public static ReadingFragment newInstance(String guid, Bookmark bookmark, String urlShare) {
ReadingFragment fragment = new ReadingFragment();
Bundle args = new Bundle();
args.putString(ARG_GUID, guid);
if(bookmark != null){
args.putSerializable(ARG_BOOKMARK, bookmark);
}
if(urlShare != null){
// --- THIS LINE IS WORKING --- //
args.putString(ARG_URLSHARE, urlShare);
}
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
readFragPresenter = new ReadFragPresenterImpl(this, getActivity().getApplication());
if (getArguments() != null) {
guidData = getArguments().getString(ARG_GUID);
bookmark = (Bookmark) getArguments().getSerializable(ARG_BOOKMARK);
// --- THIS LINE IS WORKING TOO, VALUE URLFORSHARING IS CORRECT ---
urlForSharing = getArguments().getString(ARG_URLSHARE);
Timber.d("OnCreate urlShare %s", urlForSharing);

}
fragmentManager = getFragmentManager();
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
setRetainInstance(true);
setHasOptionsMenu(true);
return inflater.inflate(R.layout.fragment_reading, container, false);
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
inflater.inflate(R.menu.menu_reading, menu);
super.onCreateOptionsMenu(menu, inflater);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

int id = item.getItemId();
switch (id){
case R.id.share:
// ---THIS IS THE PROBLEM, THIS LINE IS STILL OLD VALUE --- //
Timber.d("urlSharing selected %s", urlForSharing);
// --- THIS IS THE PROBLEM -----//
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, ""+ DeviceUtil.getApplicationName(getContext()));
shareIntent.putExtra(Intent.EXTRA_TEXT, urlForSharing);
startActivity(Intent.createChooser(shareIntent, "Share Via"));
return true;

case R.id.bookmark:
Timber.d("select item %s", bookmark.toString());
return true;
}

return super.onOptionsItemSelected(item);
}

@Override
public void resultLoadSelectedNews(boolean isSuccess, MotherArticle motherArticle) {

if(isSuccess){
Article article = motherArticle.getArticles().get(0);
//RELATED NEWS
RelatedNewsAdapter relatedNewsAdapter = new RelatedNewsAdapter(getContext(),
motherArticle.getRelates(), this);
recycleRelatedNews.setLayoutManager(new LinearLayoutManager(getContext()));
recycleRelatedNews.setAdapter(relatedNewsAdapter);

// FOR SHARING (FIRST OPENING)
urlForSharing = article.getMoreLink();

// FOR BOOKMARK (FIRST OPENING)
bookmark = new Bookmark();
bookmark.setTitle(article.getHeadLine());
Timber.d("isi bookmark -> %s", bookmark.toString());

}
progressBar.setVisibility(View.GONE);
}

@Override
public void itemClick(Related related) {

bookmark = new Bookmark();
bookmark.setTitle(related.getTitle());

// --- VALUE URLSHARE IS UPDATED HERE--//
String urlShare = related.getLink();
Timber.d("urlShared %s", urlShare);

ReadingFragment fragment = ReadingFragment.newInstance(related.getGuid(), bookmark, urlShare);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_right);
transaction.addToBackStack(null);
transaction.add(R.id.dynamic_fragment_frame, fragment, "FRAGMENT_"+related.getGuid());
transaction.commit();
}
}


the url on onOptionsItemSelected is still the old url, even though it should have been replaced by the new url the url above is still the old url, even though it should have been replaced by the new url which I have updated through the Bundle argument.







android android-fragments






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 3:06









Nanda ZNanda Z

147113




147113













  • urlForSharing is set from bundle for first time . Its only getting reset inside resultLoadSelectedNews . If resultLoadSelectedNews will never get called it won't reset . Solution is Debug your code see if resultLoadSelectedNews is getting called or not with isSuccess as true.

    – ADM
    Jan 2 at 4:08











  • resultLoadSelectedNews is called, i have console the value inside its correct as i expected. But the problem is urlForSharing is not replacing with new value after calling new fragment

    – Nanda Z
    Jan 2 at 4:40













  • That can only means Either ` urlForSharing = article.getMoreLink();` returning the same link OR your Fragment gets recreated some how .

    – ADM
    Jan 2 at 4:47











  • I just confirmed it again, the value of urlForSharing in the resultLoadSelectedNews is the update value. This value is what I need

    – Nanda Z
    Jan 2 at 4:57





















  • urlForSharing is set from bundle for first time . Its only getting reset inside resultLoadSelectedNews . If resultLoadSelectedNews will never get called it won't reset . Solution is Debug your code see if resultLoadSelectedNews is getting called or not with isSuccess as true.

    – ADM
    Jan 2 at 4:08











  • resultLoadSelectedNews is called, i have console the value inside its correct as i expected. But the problem is urlForSharing is not replacing with new value after calling new fragment

    – Nanda Z
    Jan 2 at 4:40













  • That can only means Either ` urlForSharing = article.getMoreLink();` returning the same link OR your Fragment gets recreated some how .

    – ADM
    Jan 2 at 4:47











  • I just confirmed it again, the value of urlForSharing in the resultLoadSelectedNews is the update value. This value is what I need

    – Nanda Z
    Jan 2 at 4:57



















urlForSharing is set from bundle for first time . Its only getting reset inside resultLoadSelectedNews . If resultLoadSelectedNews will never get called it won't reset . Solution is Debug your code see if resultLoadSelectedNews is getting called or not with isSuccess as true.

– ADM
Jan 2 at 4:08





urlForSharing is set from bundle for first time . Its only getting reset inside resultLoadSelectedNews . If resultLoadSelectedNews will never get called it won't reset . Solution is Debug your code see if resultLoadSelectedNews is getting called or not with isSuccess as true.

– ADM
Jan 2 at 4:08













resultLoadSelectedNews is called, i have console the value inside its correct as i expected. But the problem is urlForSharing is not replacing with new value after calling new fragment

– Nanda Z
Jan 2 at 4:40







resultLoadSelectedNews is called, i have console the value inside its correct as i expected. But the problem is urlForSharing is not replacing with new value after calling new fragment

– Nanda Z
Jan 2 at 4:40















That can only means Either ` urlForSharing = article.getMoreLink();` returning the same link OR your Fragment gets recreated some how .

– ADM
Jan 2 at 4:47





That can only means Either ` urlForSharing = article.getMoreLink();` returning the same link OR your Fragment gets recreated some how .

– ADM
Jan 2 at 4:47













I just confirmed it again, the value of urlForSharing in the resultLoadSelectedNews is the update value. This value is what I need

– Nanda Z
Jan 2 at 4:57







I just confirmed it again, the value of urlForSharing in the resultLoadSelectedNews is the update value. This value is what I need

– Nanda Z
Jan 2 at 4:57














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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54000780%2fa-variabel-on-method-onoptionsitemselected-not-update-in-fragment%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
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54000780%2fa-variabel-on-method-onoptionsitemselected-not-update-in-fragment%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith