Android setText() method not working when calling data from Java class -


i'm having trouble getting android app display right information in textviews. toasts added ensure variables being passed alright kw1, kw2 , kw3. object 'user' being passed ok, , can manually set textview settext("example") want change text in textview array results returned searchsuggest() method using following code:

for (int index3 = 0; index3 < validrecipe; index3++){          recipetext[index3].settext((setrecipes.recipes[temp[index3]].getname()));       } 

setrecipes name of java class recipes hardcoded - suggestmethod() implemented within until couldn't work , copied code here. (which explains why method no longer called anything, , within oncreate()).

does know why text in textviews aren't changing?

sorry asking, i've been sitting here fore numerous hours googling , can't find definitive answer. relatively new programming , beginner in android, basic related linking java classes android activites. let me know if need other code.

public class suggestresult extends activity     {         string kw1, kw2, kw3;         static textview [] recipetext = new textview[8];         @override         public void oncreate(bundle savedinstancestate){        super.oncreate(savedinstancestate);       setcontentview(r.layout.suggest_results);       user user1 = (user)getintent().getserializableextra("user1");       kw1 = user1.getdislikes(0);   kw2 = user1.getdislikes(1);   kw3 = user1.getdislikes(2);   recipetext[0] = (textview)findviewbyid(r.id.recipetext1);   recipetext[1] = (textview)findviewbyid(r.id.recipetext2);   recipetext[2] = (textview)findviewbyid(r.id.recipetext3);    final int maxrecipes = 6;   int[] temp = new int[maxrecipes];   int validrecipe = 0;    setrecipes.setarray();    (int index = 0; index < maxrecipes; index++)   {        if (!(setrecipes.recipes[index].searchkeywords1(kw1, kw2, kw3)))      {         temp[validrecipe] = index;          validrecipe++;      } //if   }    if (validrecipe == 0)   {      context context = getapplicationcontext();      charsequence text2 = "no valid recipes found!";      int duration = toast.length_short;      toast toast = toast.maketext(context, text2, duration);      toast.show();   }    (int index3 = 0; index3 < validrecipe; index3++)   {      recipetext[index3].settext((setrecipes.recipes[temp[index3]].getname()));    }    context context = getapplicationcontext();   charsequence text2 = kw1;   int duration = toast.length_short;   toast toast = toast.maketext(context, text2, duration);   toast.show();    } 


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -