Found 1631 Articles for Android

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

How to read all contacts in android?

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

3K+ Views

This example demonstrate about How to read all contacts 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 list view.Step 3 − Add the following code to src/MainActivity.java import android.annotation.TargetApi; import android.content.ContentResolver; import android.content.pm.PackageManager; import android.database.Cursor; import android.os.Build; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity {    public static final int ... Read More

How to pass data from one fragment to another fragment in android?

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

4K+ Views

This example demonstrate about How to pass data from one fragment to another fragment 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 fragments to pass the data between 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 implements ... Read More

How to manage startActivityForResult on Android?

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

865 Views

This example demonstrate about How to manage startActivityForResult on 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 text view to show on Activity result data.Step 3 − Add the following code to src/MainActivity.java import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView actionEvent;    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)    @Override   ... Read More

How to make a call in android

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

196 Views

This example demonstrate about How to make a call 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 list view.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.annotation.TargetApi; import android.app.Activity; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.ContactsContract; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import ... Read More

How to launch another app from your app?

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

5K+ Views

This example demonstrates How to launch another app from your appStep 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 button view to open YouTube application.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.graphics.PixelFormat; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import ... Read More

How to handle right to left swipe gestures?

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

540 Views

This example demonstrate about How to handle right to left swipe gesturesStep 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 button view to handle swapsStep 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.graphics.PixelFormat; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import ... Read More

How to handle orientation change android?

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

1K+ Views

This example demonstrate about How to handle orientation change 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 text view to show orientation changes.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; 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)    @Override    protected void onCreate(Bundle ... Read More

Advertisements