Android MaoZhuaWeiBo Adapter ListView optimization and sending Weibo, android Weibo sharing

Source: Internet
Author: User

Android MaoZhuaWeiBo Adapter ListView optimization and sending Weibo, android Weibo sharing

This article mainly tells you about the optimization of the Adapter ListView and the microblog sending. We all know that Android is in some memory-consuming classes, in order to avoid waste of resources as much as possible.

To save unnecessary resource waste, we need to optimize our components and so on.


Custom adapter:

Package com. neweriweibo. adapter;/*** adapter * @ author Engineer-Jsp * @ date 2014.10.28 **/import java. util. arrayList; import com. neweriweibo. r; import com. neweriweibo. model. userweibo iinfo; import com. squareup. picasso. picasso; import android. content. context; import android. util. log; import android. view. layoutInflater; import android. view. view; import android. view. viewGroup; import android. widget. baseAdapter; import android. widget. imageView; import android. widget. textView; public class MessageAdapter extends BaseAdapter {private Context mContext; private ArrayList <userweibo iinfo> mresult; private LayoutInflater layoutinflater; public MessageAdapter (Context context, ArrayList <userweibo iinfo> result) {mContext = context; mresult = result; layoutinflater = LayoutInflater. from (mContext) ;}@ Overridepublic int getCount () {return mresult. size () ;}@ Overridepublic Object getItem (int position) {return mresult. get (position) ;}@ Overridepublic long getItemId (int position) {return position ;}@ Overridepublic View getView (int position, View convertView, ViewGroup parent) {ViewHolder holder; view view = convertView; if (view = null) {holder = new ViewHolder (); view = layoutinflater. inflate (R. layout. message_list_item, null); holder. tvName = (TextView) view. findViewById (R. id. m_ TV _username); holder. tvMessage = (TextView) view. findViewById (R. id. m_ TV _message); holder. headimg = (ImageView) view. findViewById (R. id. weibo_item_icon); view. setTag (holder);} else {holder = (ViewHolder) view. getTag ();} Log. d ("Weibo friend message-username test:", mresult. get (position ). getName (); holder. tvName. setText (mresult. get (position ). getName (); Log. d ("Weibo friend message-content test:", mresult. get (position ). getOrigtext (); holder. tvMessage. setText (mresult. get (position ). getOrigtext (); Log. d ("Weibo friend message-profile picture address test:", mresult. get (position ). getHeadimg (); Picasso. with (view. getContext (). getApplicationContext ()). load (mresult. get (position ). getHeadimg ()). into (holder. headimg); return view;} static class ViewHolder {TextView tvName; TextView tvMessage; ImageView headimg ;}}

ViewHolder is one of the methods to optimize ListView.
 
Message sending interface:
 
 
Currently, only the text sending function is provided. Table packages are available in the source code. If you are interested, you can continue development. The following describes how to learn source code:
 
Address: <a target = _ blank href = "http://download.csdn.net/detail/jspping/8117425" target = "_ blank"> http://download.csdn.net/detail/jspping/8117425 </a> <strong> <span style = "font-size: 14px; color: # ff0000; "> </span> </strong> <pre name =" code "class =" java ">
OK. There are not many things. The key is to master the method.

 


The android ListView has been optimized by third-party class libraries.

Android-pulltorefresh is a powerful open-source project for pulling and refreshing, and supports pull-down and refreshing of various controls.
Android-pulltorefresh-listview pull-down refresh ListView
DropDownListView pull-down refresh and slide to the bottom to load more ListView
DragSortListView
SwipeListView supports defining the left and right sliding events of ListView, the left and right sliding displacement, and the animation time.
Android-SwipeToDismiss slide Item disappears ListView
StickyListHeaders GroupName
Pinned-section-listview
PinnedHeaderListView
QuickReturnHeader ListView/ScrollView header or footer
IndexableListView
CustomFastScrollView
Ndroid-ScrollBarPanel the fixed Panel indicator displayed next to the scrollbar when the ListView slides
The SlideExpandableListView user clicks the listView item to slide out of the fixed area, and the area of other items shrinks.
JazzyListView ListView and GridView item enter the screen with special animation Effects
ListViewAnimations: A ListView with an Item display animation. The animation includes the bottom fly in, other oblique fly in, lower fly in, gradient disappear, sliding Delete, etc.
DevsmartLib-Android horizontal ListView
This is the usage of my favorite ListView. You can search it on github.

 
Text description of the relationship between android adapter and Listview

In listview, A textview that displays text is displayed. In the adapter, obtain the ID of the textview and set the value to display.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.