Jump to content

Need help with android app.

Hello

 

I need help in keeping the text inside of a textview fresh every time I make changes to the Html code particularly the tags.

 

The problem here is I changed the tag from <b></b> to <i></i> or <h2>'s, the bold effect persists and does not update when I run it on the phone again. So is there any way to clear the "history" of the textview before assigning a text to it? At least that's the reason I think why the bold effect is persisting.

 

Btw, this is an app book type application.

 

Here's a portion of the code.

 

 

private class ConstructNarrative extends AsyncTask<String, Integer, String>{
String narrative = "";
Deque<String> all_lines = new LinkedList<String>();

@OverRide
protected String doInBackground(String... params) {
narrative = "";
Object [] chapter_labels = reg_book_data.get_all_chapters();
Object[] chapter_lines = reg_book_data.get_all_lines();

for(int k = 0; k < chapter_labels.length; k++){
if(chapter_labels[k].toString() == query_chapter){
all_lines.push(chapter_lines[k].toString());
}
}

//compile all text lines into one string variable.
for(String e:all_lines){
narrative = narrative + e;
}
return null;
}

@OverRide
protected void onPostExecute(String s) {
super.onPostExecute(s);

//assign compiled text lines to text view.

//put a code to reset or clear history????
txt_data.setText(Html.fromHtml(narrative));
txt_data.setGravity(Gravity.LEFT);
}
};

My system: CPU: Intel i5 6500; Mobo: H110M-k; GPU: Nvidia GT 730; Memory: 16 GB; HDD: 2x 1TB HDD;

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×