Found 1966 Articles for Apps/Applications

How to use GridLayoutManager in RecyclerView?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

201 Views

This example demonstrate about How to use GridLayoutManager in RecyclerViewStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                   In the above code, we have taken recycerview.Step 3 − Add the following code to src/MainActivity.java import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; public ... Read More

How to use firebase messaging in android application?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

317 Views

This example demonstrate How to use firebase messaging in android applicationStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to src/MainActivity.java import android.os.Bundle; import android.support.v4.app.FragmentActivity; public class MainActivity extends FragmentActivity {    @Override    public void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } }Step 3 − Add the following code to src/ MyFirebaseMessagingService.java import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.graphics.Color; import android.os.Build; import android.support.v4.app.NotificationCompat; import android.support.v4.content.ContextCompat; import android.util.Log; ... Read More

How to use findViewById in Fragment?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

5K+ Views

This example demonstrate about How to use findViewById in FragmentStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                             In the above code, we have taken two fragments.Step 3 − Add the following code to src/MainActivity.java import android.os.Bundle; import android.support.v4.app.FragmentActivity; public class MainActivity extends FragmentActivity {    @Override    public void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);   ... Read More

How to use Constraint Layout with recyclerview?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

2K+ Views

This example demonstrate about How to use Constraint Layout with recyclerviewStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                   In the above code, we have taken app bar layout and recycler view.Step 3 − Add the following code to src/MainActivity.java import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.v4.content.pm.ShortcutInfoCompat; import android.support.v4.content.pm.ShortcutManagerCompat; import android.support.v4.graphics.drawable.IconCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; ... Read More

How to use cardview in recyclerview?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

368 Views

This example demonstrates about How to use cardview in recyclerviewStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                   In the above code, we have taken app bar layout and recycler view.Step 3 − Add the following code to src/MainActivity.java import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.v4.content.pm.ShortcutInfoCompat; import android.support.v4.content.pm.ShortcutManagerCompat; import android.support.v4.graphics.drawable.IconCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import ... Read More

How to use appbar layout in android?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

3K+ Views

This example demonstrate about How to use appbar layout in androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                   In the above code, we have taken app bar layout and recycler view.Step 3 − Add the following code to src/MainActivity.java import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.v4.content.pm.ShortcutInfoCompat; import android.support.v4.content.pm.ShortcutManagerCompat; import android.support.v4.graphics.drawable.IconCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; ... Read More

How to Use Android loader?

Nitya Raut
Updated on 30-Jul-2019 22:30:25

991 Views

This example demonstrate about How to Use Android loaderStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. ss     In the above code, we have taken listview to show contact names.Step 3 − Add the following code to src/MainActivity.java import android.Manifest; import android.content.CursorLoader; import android.content.Loader; import android.content.pm.PackageManager; import android.database.Cursor; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import android.support.v4.content.ContextCompat; import android.support.v4.widget.SimpleCursorAdapter; import android.widget.ListView; public class MainActivity extends FragmentActivity implements android.app.LoaderManager.LoaderCallbacks {    private ... Read More

How to update RecyclerView Adapter Data?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

746 Views

This example demonstrate about How to update RecyclerView Adapter DataStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         In the above code, we have taken recycerview.Step 3 − Add the following code to src/MainActivity.java import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.support.v4.content.pm.ShortcutInfoCompat; import android.support.v4.content.pm.ShortcutManagerCompat; import android.support.v4.graphics.drawable.IconCompat; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; public class MainActivity ... Read More

How to send message from firebase console after creation project?

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

83 Views

Open your firebase page (https://console.firebase.google.com/) as shown below –Now select your project. In our case we have tutorialspoint project. It will direct to console page of project as shown below –Now scroll down right side menu to grow as shown below –In Grow tab select Cloud messaging as shown below –Now click on new notification button. It will redirect to compose message button as shown below –Now write your message as shown below –Now click on next to go target tab. Now select project as shown below –Now click on next button to go schedule as shown below –Now click ... Read More

How to save an Android Activity state using save instance state?

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

658 Views

This example demonstrate about How to save an Android Activity state using save instance stateStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken text view to show restore instance elements.Step 3 − Add the following code to src/MainActivity.java import android.os.Build; import android.os.Bundle; import android.os.PersistableBundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView actionEvent;    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)   ... Read More

Advertisements