SpannableString not set in textview when back button press in Oreo
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I set text view data from SpannableString. It works correct. But when I press back button from another activity text view not shown data in Oreo. It works correctly in other version but not work in high version. What is reason?
Here my code for set data:
tvItinerari=(TextView) view.findViewById(R.id.tv_1);
String text = "";
String name = "";
for (Itinerary item : arrayList)
text += item.getItinerary()+" ";
SpannableString ss = new SpannableString(text);
int start = 0, end;
for (final Itinerary item : arrayList)
setSpanOnLink(ss, item.getItinerary(), new MyClickableSpan(item));
tvItinerari.setText(ss);
Log.e("ss",""+ss);
class MyClickableSpan extends ClickableSpan {// extend ClickableSpan
Itinerary clicked;
public MyClickableSpan(Itinerary string)
super();
clicked = string;
public void onClick(View tv)
clicked.setCityName(tvBack.getText().toString());
AppUtil.itinerary=clicked;
FragmentTransaction transaction =
getFragmentManager().beginTransaction();
transaction.replace(R.id.frame_container, new ItinerarioFragment());
transaction.addToBackStack("tag").commit();
public void updateDrawState(TextPaint ds)
// override updateDrawState
ds.setUnderlineText(false); // set to false to remove underline
private void setSpanOnLink(SpannableString ss, String link,
ClickableSpan cs)
String text = ss.toString();
int start = text.indexOf(link);
int end = start + link.length();
ss.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
// ss.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
It works in all version not in Oreo.
Data show correctly in low version like lollipop but not work in High version.

|
show 8 more comments
I set text view data from SpannableString. It works correct. But when I press back button from another activity text view not shown data in Oreo. It works correctly in other version but not work in high version. What is reason?
Here my code for set data:
tvItinerari=(TextView) view.findViewById(R.id.tv_1);
String text = "";
String name = "";
for (Itinerary item : arrayList)
text += item.getItinerary()+" ";
SpannableString ss = new SpannableString(text);
int start = 0, end;
for (final Itinerary item : arrayList)
setSpanOnLink(ss, item.getItinerary(), new MyClickableSpan(item));
tvItinerari.setText(ss);
Log.e("ss",""+ss);
class MyClickableSpan extends ClickableSpan {// extend ClickableSpan
Itinerary clicked;
public MyClickableSpan(Itinerary string)
super();
clicked = string;
public void onClick(View tv)
clicked.setCityName(tvBack.getText().toString());
AppUtil.itinerary=clicked;
FragmentTransaction transaction =
getFragmentManager().beginTransaction();
transaction.replace(R.id.frame_container, new ItinerarioFragment());
transaction.addToBackStack("tag").commit();
public void updateDrawState(TextPaint ds)
// override updateDrawState
ds.setUnderlineText(false); // set to false to remove underline
private void setSpanOnLink(SpannableString ss, String link,
ClickableSpan cs)
String text = ss.toString();
int start = text.indexOf(link);
int end = start + link.length();
ss.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
// ss.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
It works in all version not in Oreo.
Data show correctly in low version like lollipop but not work in High version.

Your code seems incomplete . What is methodsetSpanOnLink
? and what isMyClickableSpan
?
– ADM
Nov 15 '18 at 9:46
Your code is not enough to understand the issue, please provide us with some more information from the code.
– Ümañg ßürmån
Nov 15 '18 at 9:47
please check edited code @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:51
@krupagevariya What is that you want to achieve?
– Ümañg ßürmån
Nov 15 '18 at 9:56
i have one textview and i try to set data from SpannableString in textview. all data set in textview correctly but when i go next activity or fragmernt and back press textview data not shown in high version like Oreo. in small version textview data show when back press. @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:59
|
show 8 more comments
I set text view data from SpannableString. It works correct. But when I press back button from another activity text view not shown data in Oreo. It works correctly in other version but not work in high version. What is reason?
Here my code for set data:
tvItinerari=(TextView) view.findViewById(R.id.tv_1);
String text = "";
String name = "";
for (Itinerary item : arrayList)
text += item.getItinerary()+" ";
SpannableString ss = new SpannableString(text);
int start = 0, end;
for (final Itinerary item : arrayList)
setSpanOnLink(ss, item.getItinerary(), new MyClickableSpan(item));
tvItinerari.setText(ss);
Log.e("ss",""+ss);
class MyClickableSpan extends ClickableSpan {// extend ClickableSpan
Itinerary clicked;
public MyClickableSpan(Itinerary string)
super();
clicked = string;
public void onClick(View tv)
clicked.setCityName(tvBack.getText().toString());
AppUtil.itinerary=clicked;
FragmentTransaction transaction =
getFragmentManager().beginTransaction();
transaction.replace(R.id.frame_container, new ItinerarioFragment());
transaction.addToBackStack("tag").commit();
public void updateDrawState(TextPaint ds)
// override updateDrawState
ds.setUnderlineText(false); // set to false to remove underline
private void setSpanOnLink(SpannableString ss, String link,
ClickableSpan cs)
String text = ss.toString();
int start = text.indexOf(link);
int end = start + link.length();
ss.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
// ss.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
It works in all version not in Oreo.
Data show correctly in low version like lollipop but not work in High version.

I set text view data from SpannableString. It works correct. But when I press back button from another activity text view not shown data in Oreo. It works correctly in other version but not work in high version. What is reason?
Here my code for set data:
tvItinerari=(TextView) view.findViewById(R.id.tv_1);
String text = "";
String name = "";
for (Itinerary item : arrayList)
text += item.getItinerary()+" ";
SpannableString ss = new SpannableString(text);
int start = 0, end;
for (final Itinerary item : arrayList)
setSpanOnLink(ss, item.getItinerary(), new MyClickableSpan(item));
tvItinerari.setText(ss);
Log.e("ss",""+ss);
class MyClickableSpan extends ClickableSpan {// extend ClickableSpan
Itinerary clicked;
public MyClickableSpan(Itinerary string)
super();
clicked = string;
public void onClick(View tv)
clicked.setCityName(tvBack.getText().toString());
AppUtil.itinerary=clicked;
FragmentTransaction transaction =
getFragmentManager().beginTransaction();
transaction.replace(R.id.frame_container, new ItinerarioFragment());
transaction.addToBackStack("tag").commit();
public void updateDrawState(TextPaint ds)
// override updateDrawState
ds.setUnderlineText(false); // set to false to remove underline
private void setSpanOnLink(SpannableString ss, String link,
ClickableSpan cs)
String text = ss.toString();
int start = text.indexOf(link);
int end = start + link.length();
ss.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
// ss.setSpan(cs, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
It works in all version not in Oreo.
Data show correctly in low version like lollipop but not work in High version.


edited Nov 15 '18 at 13:01


Fantômas
32.9k156491
32.9k156491
asked Nov 15 '18 at 9:43


krupa gevariyakrupa gevariya
907
907
Your code seems incomplete . What is methodsetSpanOnLink
? and what isMyClickableSpan
?
– ADM
Nov 15 '18 at 9:46
Your code is not enough to understand the issue, please provide us with some more information from the code.
– Ümañg ßürmån
Nov 15 '18 at 9:47
please check edited code @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:51
@krupagevariya What is that you want to achieve?
– Ümañg ßürmån
Nov 15 '18 at 9:56
i have one textview and i try to set data from SpannableString in textview. all data set in textview correctly but when i go next activity or fragmernt and back press textview data not shown in high version like Oreo. in small version textview data show when back press. @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:59
|
show 8 more comments
Your code seems incomplete . What is methodsetSpanOnLink
? and what isMyClickableSpan
?
– ADM
Nov 15 '18 at 9:46
Your code is not enough to understand the issue, please provide us with some more information from the code.
– Ümañg ßürmån
Nov 15 '18 at 9:47
please check edited code @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:51
@krupagevariya What is that you want to achieve?
– Ümañg ßürmån
Nov 15 '18 at 9:56
i have one textview and i try to set data from SpannableString in textview. all data set in textview correctly but when i go next activity or fragmernt and back press textview data not shown in high version like Oreo. in small version textview data show when back press. @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:59
Your code seems incomplete . What is method
setSpanOnLink
? and what is MyClickableSpan
?– ADM
Nov 15 '18 at 9:46
Your code seems incomplete . What is method
setSpanOnLink
? and what is MyClickableSpan
?– ADM
Nov 15 '18 at 9:46
Your code is not enough to understand the issue, please provide us with some more information from the code.
– Ümañg ßürmån
Nov 15 '18 at 9:47
Your code is not enough to understand the issue, please provide us with some more information from the code.
– Ümañg ßürmån
Nov 15 '18 at 9:47
please check edited code @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:51
please check edited code @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:51
@krupagevariya What is that you want to achieve?
– Ümañg ßürmån
Nov 15 '18 at 9:56
@krupagevariya What is that you want to achieve?
– Ümañg ßürmån
Nov 15 '18 at 9:56
i have one textview and i try to set data from SpannableString in textview. all data set in textview correctly but when i go next activity or fragmernt and back press textview data not shown in high version like Oreo. in small version textview data show when back press. @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:59
i have one textview and i try to set data from SpannableString in textview. all data set in textview correctly but when i go next activity or fragmernt and back press textview data not shown in high version like Oreo. in small version textview data show when back press. @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:59
|
show 8 more comments
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%2f53316497%2fspannablestring-not-set-in-textview-when-back-button-press-in-oreo%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%2f53316497%2fspannablestring-not-set-in-textview-when-back-button-press-in-oreo%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
Your code seems incomplete . What is method
setSpanOnLink
? and what isMyClickableSpan
?– ADM
Nov 15 '18 at 9:46
Your code is not enough to understand the issue, please provide us with some more information from the code.
– Ümañg ßürmån
Nov 15 '18 at 9:47
please check edited code @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:51
@krupagevariya What is that you want to achieve?
– Ümañg ßürmån
Nov 15 '18 at 9:56
i have one textview and i try to set data from SpannableString in textview. all data set in textview correctly but when i go next activity or fragmernt and back press textview data not shown in high version like Oreo. in small version textview data show when back press. @Ümañgßürmån
– krupa gevariya
Nov 15 '18 at 9:59