简体   繁体   中英

Using button in Android to call an activity and a web service

I want to know whether a single button in Android can call a web service as well as start another activity ie move to another splash screen when pressed.

Is this possible ? Can a single button have two Events ? If yes,how ?

A button can have only one ClickListener but you call a web service and start an activity from this listener.

EDIT :

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        callWebService();
        startAnotherActivity();
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM