android - get item view type in adapter returning only 1 item -
I have a custom adapter that will increase the two layouts according to a certain condition. Only 1 item is returning to GetItemViewType status, while there are two and when I present it in the list, the adapter is not the other with a layout, and I can see in my list that there is a place left for it, but Its empty here is my code When I run the app, the list shows a type of 1 layout and leaves the place for type 0 But it is not presented. Any help You must override Enter the code here Public class ListViewAdapter ArrayAdapter and lt; NewsFeed & gt; {Private Static Last Interval: missionLayout = 0; Private static final interval badge layout = 1; Private Treascape mSeparatorsSet = New TreeSet (); Public catalogs (adapter) (super {city newsfid.activity.ece, r.latout.activity_activitabine_news_prod, newsfeed); } @ Override Public Intimate Image Type (Int Position) {Return M.Sp.CatternConnect (status)? Mission Layout: Badge Layout; } @ Override public view getView (integer position, seeviewview, ViewGroup parent) {ViewHolder holder = Faucet; Int type = getItemViewType (status); System.out.println ("getView" + Status + "+ ConvertView +" Type = "+" type); If (convertView == Faucet) {NewsFeed obj = newsfeed.get (status); Holder = New Viewholder (); Switch (type) {case mission layout log d. ( "free 3 La mission layout", "Tots IL case"); ConvertView = getLayoutInflater (). inflate (Rklayoutkcity_news_single_item, parents, false); Holder.civilianImage = (ImageView) Knhwartwufindwubiaiaidi (RkidkimageView2); Dharkkhoronam = (Text View) Knwartwufindwubiaiaidi (Arkdidkbadgenum); holder = details = (Text View) Knwar Wukfindwubiaiaidi (Arkdkdiskripshn); holder. Timeline = (Text View) Knwartwufindwubiaiaidi (Arkaikdik posted); holder KrelativeLayoutMission = (relative layout) Knhwartwufindwubiaiaidi (Araid .relativeLayout); if (obj. Categorykequals ( "mission")) (if (Objkaccepted_rejectedkequals ( "success")) {holder.relativeLayoutMission.setBackgroundResource (R.drawable.mission_successful); float alpha = Flotkvluof ( "0.9"); holder .relativeLayoutMission.setAlpha (alpha); Byte [] decodedString = Base64.decode (obj.picture, Base64.DEFAULT); Bitmap decodedbie = bitmapficht. Decodbiteare (decoded string, 0, decoded string; Lang); Bitmap Circle Bitmap = Bitmap.CreateBitmap (decodedbytegateview (), decodedbit.gatehit (), bitmap config.argb_8888); Bitmapshader shader = new bitmap shader (decodedbite, shader.telmoda.clamp, shader.tileMode.CLAMP); Paint paint = new paint (); Paint.setShader (Shader); Canvas C = new canvas (circle bitmap); C.drawCircle (decodedByte.getWidth () / 2, DecodeBitGetHight () / 2, DecodedBit .getWidth () / 2, Paint); Holder.civilianImage.setImageBitmap (circleBitmap); Drawable d = getResources (). GetDrawable (R.drawable.circle_shape_for_civilian_success); Holder.civilianImage.setBackgroundDrawable (d); String hero = obj.mission_nickname; Holder. Hieronym.Set Text (HTML from HTML ("& font color = '# FAD 84F' & gt;" + Hero + "& lt; / font & gt;" + + saved + + obj.firstname Holder.description.setText (obj.lastname); holder.timeRemaining.setText (obj.mission_postedSince);}} breakdown; case badge layout: convertview = meet-in-enterer (). (r. Lett. Baj_sinling_aitem, blank); holder KrelativeLayoutBadge = (relative layout) Knhwartwufindwubiaiaidi (Araid .relativeLayout); holder. Bagejanam = (Text View) Knwartwufindwubia EID (Arkdidkbadgenum); Dharkkbajaimej = (Image View) Knwartwufindwubiaiaidi (Arkaidkimej VI 2); holder. Timeline = (Text View) Knwartwufindwubiaiaidi (Arkaikdik posted); if (obj .category.equals ( "badges")) {holder.relativeLayoutBadge.setBackgroundResource (R.drawable.earned_badge_post); float alpha = Flotkvluof ( "0.9"); holder.relativeLayoutBadge.setAlpha (alpha); string hero = obj. Nickname; holder.bzname .set text (html from "html" ("& lt; Font color = '# FAD 84F' & gt; "+ Hero +" & lt; / Font & gt; "+" earns a new badge! ")); Drayniy D = Miller Resources (). GetDrawable (R.drawable.circle_shape_for_badge); holder.badgeImage.setBackgroundDrawable (d); string imageUrl =" http: //iamheroic.net/iamheroic/badge_images/ "+ obj.icon; ImageLoader.displayImage (imageUrl, holder. badges image, options); holder.timeRemaining.setText (obj.postedSince);} break;} If (convertView! = Null) {convertView.setTag (Holder);}} Return Convertview;}}
getViewTypeCount ()
ListView Specify how many item types it expects to handle each type of recycling scenes.
@ Override Public Entry Popup () {Return 2;} < / Code>
Comments
Post a Comment