Adding Snackbar Library

Hi all, I have went through Android Developer site and ended up here- :face_with_monocle:
https://developer.android.com/reference/com/google/android/material/button/package-summary

In this I can see that there are more other methods for button. So I decided to create an extension with more functions. Now, my problem is that how can I import the library to my extension-With what name I have to import. Your answers will be highly appreciated.

Thank you. :smiling_face_with_three_hearts:

import com.google.android.material.button;

It is for button?

or Generalized

Yes if din't work try

import com.google.android.material.button.*;

And what about Floating Action Button
https://developer.android.com/reference/com/google/android/material/floatingactionbutton/FloatingActionButton#summary

For button I posted
For general
import com.google.android.material.*;

1 Like

What about This.... :sweat_smile:

Really I needed the library for Snackbar
I thought that it would be better to learn from simplest to hardest :joy:

Import last line of the chart
com.google....
Screenshot_20210207-165403-1

So for Snackbar, we need to use-

com.google.android.material.snackbar.Snackbar
1 Like

Screenshot_20210207-165911-1
Import that fully

Yes use it

1 Like

Thank you let me check.. :smiling_face_with_three_hearts:

Can I PM you?

@HIFI_APPS Can you please say what are the imports for a snackbar. I am confused.

U can pm,

import com.google.android.material.snackbar.*;

For snackbar

1 Like

As far as I know app Inventor doesn't have any library that adds the snackbar class, you would also have to add the android material design library to your extension ( which contains the Snackbar classes ). Or you would get an error that the package doesn't exist.

How can I add?

I have added this class-

com.google.android.material.floatingactionbutton.FloatingActionButton

You would have to get the material library jar file, because it doesn't exist in the current sources.
You will find its Aar file here, you can try to extract the classes.jar file, and use it with your extension ( for the app Inventor Sources see here, for the extension template see this topic, if you are using Appybuilder, so it's not possible ):
https://mvnrepository.com/artifact/com.google.android.material/material/1.3.0

4 Likes