Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Create new activity using float action button (fab)?

Hi can somebody have a suggestions on how to make a new activity using Fab like if you click the fab button it will show up a side transition saying hello world? actually i am creating a chat app and i want to replace the "hello world" with my contacts.

i got a reference link or source code regarding the float action button i mention.what i did is i removed the list view so that only the fab button is on the screen, http://www.myandroidsolutions.com/2015/01/01/android-floating-action-button-fab-tutorial

any comments or suggestion will be helpful for me to execute this. thanks!

like image 341
Cliff Avatar asked Nov 17 '25 05:11

Cliff


1 Answers

Just put the intent to your new activity in

fabImageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //here
                startActivity(new Intent(YourCurrentActivity.this,NewActivity.class));
            }
        });
like image 188
Lakhwinder Singh Avatar answered Nov 18 '25 19:11

Lakhwinder Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!