Android tutorialAndroid development

Android how to Implement App suggestion when open first time

Hii Developer in this Android Article, I am sharing android how to Implement App suggestion when open the first time.  Hare is an easy way to make your App user-friendly. Android how to used App Suggestion. For making these Android Example I am using a Github library  MaterialTapTargetPrompt.

This Android library working with AndroidX and google design material. So if you want to implement this in your old Project firstly you can marge your project with Android X.

Let’s Start on android how to Implement App suggestion when open the first time.

Step 1: Create an Android Project with a Tabbar Android Activity.

Firstly you can create an android project and create an activity with select Tabbar activity.

Step 2: Add This Libary in your App base Build.Gradle.

implementation 'uk.co.samuelwall:material-tap-target-prompt:3.0.0'

add this library and sync now your project.

Step 3: Open You java File and Implement this code.

in your java file, you can add these code whare your want to add App suggestion in your App.

new MaterialTapTargetPrompt.Builder(MainActivity.this)
        .setTarget(R.id.fab)
        .setPrimaryText("Hii Codeplayon")
        .setSecondaryText("Tap the envelope to start composing your first email")
        .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener()
        {
            @Override
            public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state)
            {
                if (state == MaterialTapTargetPrompt.STATE_FOCAL_PRESSED)
                {
                    // User has pressed the prompt target
                }
            }
        })
        .show();

Full Source code App suggestion with a TabBar activity you can implement  these methods

public void AppDemo(){
    new MaterialTapTargetSequence()
            .addPrompt(new MaterialTapTargetPrompt.Builder(Home.this)
                    .setTarget(findViewById(R.id.nav_view))
                    .setPrimaryText("Navi Bar Menu ")
                    .setSecondaryText("Here you can see all you menu like Profile , Cart , CP Wallet , Facebook , Youtube, etc. ")
                    .setFocalPadding(R.dimen.dp40)
                    .setIcon(R.drawable.icons_menu)
                    .create(), 4000)
            .addPrompt(new MaterialTapTargetPrompt.Builder(Home.this)
                    .setTarget(findViewById(R.id.action_item1))
                    .setPrimaryText("Home Button")
                    .setSecondaryText("Here you can find all new coursed list you can contact us Email, and Apply online Course  ")
                    .setFocalPadding(R.dimen.dp40)
                    .setIcon(R.drawable.ic_account_balance_white_24dp)
                    .create(), 4000)
            .addPrompt(new MaterialTapTargetPrompt.Builder(Home.this)
                    .setTarget(findViewById(R.id.action_item2))
                    .setPrimaryText("Profile")
                    .setSecondaryText("Here you can see you profile ")
                    .setFocalPadding(R.dimen.dp40)
                    .setIcon(R.drawable.ic_perm_identity_white_24dp)
                    .create(), 4000)
            .addPrompt(new MaterialTapTargetPrompt.Builder(Home.this)
                    .setTarget(findViewById(R.id.action_item3))
                    .setPrimaryText("Cart")
                    .setSecondaryText("Here you can find you all Applying Courses and you can download you ID Card and  Certificate after Complete course  easy way after")
                    .setFocalPadding(R.dimen.dp40)
                    .setIcon(R.drawable.ic_add_shopping_cart_white_24dp)
                    .create(), 4000)
            .addPrompt(new MaterialTapTargetPrompt.Builder(Home.this)
                    .setTarget(findViewById(R.id.action_item4))
                    .setPrimaryText("WhatsApp Chat ")
                    .setSecondaryText("Click on chat button you can directly chat with management for any help")
                    .setFocalPadding(R.dimen.dp40)
                    .setIcon(R.drawable.chat)
                    .create(), 4000)
            .addPrompt(new MaterialTapTargetPrompt.Builder(Home.this)
                    .setTarget(findViewById(R.id.action_item5))
                    .setPrimaryText("Contact US")
                    .setSecondaryText("In Contect you can communicate with managements vis email , call , and web ")
                    .setAnimationInterpolator(new LinearOutSlowInInterpolator())
                    .setFocalPadding(R.dimen.dp40)
                    .setIcon(R.drawable.icons_address))
            .show();
}