Re: [android-developers] Re: adapter.notifyDataSetChanged not working
This listview is in the activiyt group of tabactivity. On Wed, Feb 15, 2012 at 6:41 PM, vani reddy wrote: > > public View getView(final int position, View convertView, ViewGroup >> parent) { >> try { >> final Show channelShowItem = (Show) >> myCurrentShowsList.getData() >> .get(position); >> >> convertView = inflater.inflate(R.layout.channel_item, null); >> ViewHolder holder = new ViewHolder(); >> >> holder.logoLayout = (LinearLayout) convertView >> .findViewById(R.id.logoLayout); >> if (channelShowItem.getCountry().equals("IN_airtel")) { >> holder.logoLayout.setBackgroundDrawable(null); >> } >> holder.channelLogo = (ImageView) convertView >> .findViewById(R.id.channelLogo); >> holder.discussionCount = (TextView) convertView >> .findViewById(R.id.discussionCount); >> holder.ActivityInfo = (TextView) convertView >> .findViewById(R.id.ActivityInfo); >> holder.showName = (TextView) convertView >> .findViewById(R.id.showName); >> holder.channelname = (TextView) convertView >> .findViewById(R.id.channelname); >> >> holder.showName.setTypeface(fontObj); >> holder.channelname.setTypeface(fontObj_myraid); >> holder.showTiming = (TextView) convertView >> .findViewById(R.id.showTiming); >> holder.viewCount = (TextView) convertView >> .findViewById(R.id.ChannelViewCount); >> >> holder.discussionCount.setText(String.valueOf(channelShowItem >> .getComment_count())); >> >> if (channelShowItem.getFbids_watching() != null) { >> System.out.println("INSIDE IF ***"); >> try { >> String textToDisplay = >> UserAPIHandler.getFriendsWatching( >> channelShowItem.getFbids_watching(), fList); >> holder.ActivityInfo.setText(textToDisplay); >> System.out.println("LSITING >> "+channelShowItem.getListing_name()); >> System.out.println("channelname >> "+channelShowItem.getCh_name()); >> System.out.println("COUNT >> "+channelShowItem.getFbids_watching().size()); >> holder.viewCount.setText("" >> + channelShowItem.getFbids_watching().size()); >> } catch (Exception e) { >> e.printStackTrace(); >> } >> } else { >> System.out.println("INSIDE ESLE*#**"); >> System.out.println("LSITING >> "+channelShowItem.getListing_name()); >> System.out.println("channelname >> "+channelShowItem.getCh_name()); >> System.out.println("COUNT 0"); >> holder.viewCount.setText("0"); >> holder.ActivityInfo.setText(""); >> } >> >> String temp = channelShowItem.getIcon(); >> Utility.setImageFromAssets(activity, temp, >> holder.channelLogo); >> >> holder.showName.setText(channelShowItem.getListing_name()); >> holder.channelname.setText(channelShowItem.getCh_name()); >> >> long startMilliSeconds = >> Long.parseLong(channelShowItem.getStart() >> .getSec()) * 1000; >> long endMilliSeconds = >> Long.parseLong(channelShowItem.getStop() >> .getSec()) * 1000; >> Date startDate = new Date(startMilliSeconds); >> Date endDate = new Date(endMilliSeconds); >> >> if (channelShowItem.getCountry().equals("IN_airtel")) { >> >> startDate.setHours(startDate.getHours() - 5); >> startDate.setMinutes(startDate.getMinutes() - 30); >> endDate.setHours(endDate.getHours() - 5); >> endDate.setMinutes(endDate.getMinutes() - 30); >> } >> SimpleDateFormat endFormatter = new SimpleDateFormat("HH:mm"); >> >> String startDisplay = endFormatter.format(startDate); >> String endDisplay = endFormatter.format(endDate); >> >> String showTimings = startDisplay + " - " + endDisplay; >> >> holder.showTiming.setText(showTimings); >> >> convertView.setTag(holder); >> >> convertView.setOnClickListener(new OnClickListener() { >> >> @Override >> public void onClick(View v) { >> >> >> activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); >> >> Intent intent = new Intent(v.getContext(), >> ChannelDetailShowListActivity.class); >> Bundle myData = new Bundle(); >
Re: [android-developers] Re: adapter.notifyDataSetChanged not working
> public View getView(final int position, View convertView, ViewGroup > parent) { > try { > final Show channelShowItem = (Show) > myCurrentShowsList.getData() > .get(position); > > convertView = inflater.inflate(R.layout.channel_item, null); > ViewHolder holder = new ViewHolder(); > > holder.logoLayout = (LinearLayout) convertView > .findViewById(R.id.logoLayout); > if (channelShowItem.getCountry().equals("IN_airtel")) { > holder.logoLayout.setBackgroundDrawable(null); > } > holder.channelLogo = (ImageView) convertView > .findViewById(R.id.channelLogo); > holder.discussionCount = (TextView) convertView > .findViewById(R.id.discussionCount); > holder.ActivityInfo = (TextView) convertView > .findViewById(R.id.ActivityInfo); > holder.showName = (TextView) convertView > .findViewById(R.id.showName); > holder.channelname = (TextView) convertView > .findViewById(R.id.channelname); > > holder.showName.setTypeface(fontObj); > holder.channelname.setTypeface(fontObj_myraid); > holder.showTiming = (TextView) convertView > .findViewById(R.id.showTiming); > holder.viewCount = (TextView) convertView > .findViewById(R.id.ChannelViewCount); > > holder.discussionCount.setText(String.valueOf(channelShowItem > .getComment_count())); > > if (channelShowItem.getFbids_watching() != null) { > System.out.println("INSIDE IF ***"); > try { > String textToDisplay = > UserAPIHandler.getFriendsWatching( > channelShowItem.getFbids_watching(), fList); > holder.ActivityInfo.setText(textToDisplay); > System.out.println("LSITING > "+channelShowItem.getListing_name()); > System.out.println("channelname > "+channelShowItem.getCh_name()); > System.out.println("COUNT > "+channelShowItem.getFbids_watching().size()); > holder.viewCount.setText("" > + channelShowItem.getFbids_watching().size()); > } catch (Exception e) { > e.printStackTrace(); > } > } else { > System.out.println("INSIDE ESLE*#**"); > System.out.println("LSITING > "+channelShowItem.getListing_name()); > System.out.println("channelname > "+channelShowItem.getCh_name()); > System.out.println("COUNT 0"); > holder.viewCount.setText("0"); > holder.ActivityInfo.setText(""); > } > > String temp = channelShowItem.getIcon(); > Utility.setImageFromAssets(activity, temp, holder.channelLogo); > > holder.showName.setText(channelShowItem.getListing_name()); > holder.channelname.setText(channelShowItem.getCh_name()); > > long startMilliSeconds = > Long.parseLong(channelShowItem.getStart() > .getSec()) * 1000; > long endMilliSeconds = Long.parseLong(channelShowItem.getStop() > .getSec()) * 1000; > Date startDate = new Date(startMilliSeconds); > Date endDate = new Date(endMilliSeconds); > > if (channelShowItem.getCountry().equals("IN_airtel")) { > > startDate.setHours(startDate.getHours() - 5); > startDate.setMinutes(startDate.getMinutes() - 30); > endDate.setHours(endDate.getHours() - 5); > endDate.setMinutes(endDate.getMinutes() - 30); > } > SimpleDateFormat endFormatter = new SimpleDateFormat("HH:mm"); > > String startDisplay = endFormatter.format(startDate); > String endDisplay = endFormatter.format(endDate); > > String showTimings = startDisplay + " - " + endDisplay; > > holder.showTiming.setText(showTimings); > > convertView.setTag(holder); > > convertView.setOnClickListener(new OnClickListener() { > > @Override > public void onClick(View v) { > > > activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); > > Intent intent = new Intent(v.getContext(), > ChannelDetailShowListActivity.class); > Bundle myData = new Bundle(); > myData.putSerializable("currentShow", channelShowItem); > myData.putString("class", "guide"); > intent.putExtras(myData); > > View view1 = EPG