Java Sina Weibo client development step 3

Source: Internet
Author: User

Implementation: "pull-down refresh" and prompt.

The package structure is as follows:


1. Modify myscrollpane with the following key code:

Verticalscrollbar. addadjustmentlistener (New adjustmentlistener (){

Public void adjustmentvaluechanged (adjustmentevent e ){

// The maximum value of the getmaximum () scroll bar is the maximum span.

// Visible size of getvisibleamount ()

Int currentvalue = getverticalscrollbar (). getmaximum ()

-Getverticalscrollbar (). getvisibleamount ();

If (E. getvalue () = currentvalue &&! Friendtl. isloading ()){

Friendtl. addpage ();

}

}

});

2. Modify the friendtimeline and timeline classes. key code:

Try {

If (lastid = long. max_value ){

Statuswapper = TM. getfriendstimeline (0, 0,

New paging (1 ));

} Else {

Statuswapper = TM. getfriendstimeline (0, 0,
Lastid );

}

} Catch (weiboexception e ){

E. printstacktrace ();

}

Note:

Statuswapper = TM. getfriendstimeline (0, 0,
Getfriendstimeline (0, 0,
Lasti)

The method must be added to the timeline API provided by Sina as follows:

Public statuswapper getfriendstimeline (integer baseapp, integer feature, long max_id) throws weiboexception {

Return status. constructwapperstatus (Weibo. Client. Get (

Weiboconfig. getvalue ("baseurl") + "statuses/friends_timeline.json ",

New postparameter [] {

New postparameter ("base_app", baseapp. tostring ()),

New postparameter ("feature", feature. tostring ()),

New postparameter ("max_id", max_id.tostring ())}));

}

3. added the tipdialog class as a prompt.
4. Modify the main class and add fields.

Public static maindialog;

The running result is as follows:

Download Code:

Java Sina Weibo client development step 3 (micro disk)

Java Sina Weibo client development step 3 (csdn)

For more information, see:

Java Sina Weibo client development step 1

Java Sina Weibo client development step 2

For original works, please indicate the source for reprinting: All snails know

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.