خرید بک لینک

Vote count: 0

so I have this fragment which includes multiple TextView that gets changed when user clicks on a "next" button or "previous" button.

within the onCreateView method i have:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View inflatedView = inflater.inflate(R.layout.fragment_time_table, container, false);


    update(inflatedView,worker.current.getTarih(),worker.current.getHicri(),worker.current.getGün(),worker.current.getImsak(),worker.current.getSabah(),worker.current.getGüneş(),worker.current.getÖğle(),worker.current.getIkindi(),worker.current.getAkşam(),worker.current.getYatsı());


    // Inflate the layout for this fragment
    retu inflatedView;


}

on the update method I have

public void update(View dimension,String tarih, String hicri, String gun, String imsak, String sabah, String gunes, String ogle, String ikindi, String aksam, String yatsi){

    TextView gunView = (TextView) dimension.findViewById(R.id.gun);
    TextView imsakView = (TextView) dimension.findViewById(R.id.imsak);
    TextView sabahView = (TextView) dimension.findViewById(R.id.sabah);
    TextView gunesView = (TextView) dimension.findViewById(R.id.gunes);
    TextView ogleView = (TextView) dimension.findViewById(R.id.ogle);
    TextView ikindiView = (TextView) dimension.findViewById(R.id.ikindi);
    TextView aksamView = (TextView) dimension.findViewById(R.id.aksam);
    TextView yatsiView = (TextView) dimension.findViewById(R.id.yatsi);


    gunView.setText(gun);
    imsakView.setText(imsak);
    sabahView.setText(sabah);
    gunesView.setText(gunes);
    ogleView.setText(ogle);
    ikindiView.setText(ikindi);
    aksamView.setText(aksam);
    yatsiView.setText(yatsi);
}

the update method gets called on user click. It occurs to me that the textview is redefined everytime update() is called. I tried defining TextView on the onCreate method but I kept on getting NPE.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 17 ارديبهشت 1395 ساعت: 20:43

صفحه بندی