This example demonstrate about How do I add Vibrate and sound for Notification 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. Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme; import android.app.NotificationManager; import android.content.Context; import android.media.RingtoneManager; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import java.util.Objects; public class MainActivity extends AppCompatActivity { private final static String default_notification_channel_id = "default" ; @Override protected ... Read More
This example demonstrate about How to set android notification iconStep 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. Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme; import android.app.NotificationManager; import android.content.Context; import android.support.v4.app.NotificationCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import java.util.Objects; public class MainActivity extends AppCompatActivity { private final static String default_notification_channel_id = "default"; @Override protected void onCreate (Bundle savedInstanceState) { super .onCreate(savedInstanceState); ... Read More
In this article, we will learn about special functions and constants available in the math module in the Python Standard Library.Here we will discuss some constants like −pieinfNantauAnd some functions likeGammaIsinfIsnanisfinite()erf()Let's discuss constants and their respective values −pi3.141592…..e2.718281…...inf6.283185…...nantauNow let’s discuss some special functions and their implementation −Gamma − return the value of gamma(n)Isinf − checks whether the value of the function is infinity or not.Isnan − check whether the return value is a number or not.Isfinite − return True if the value is neither an infinity or a nan false otherwiseErf − returns the error function of x.Now let;’s take ... Read More
In this article, we will learn about intersection() function that can be performed on any given set. According to mathematics intersection means finding out common elements from the two sets.Syntax.intersection( ……..)Return Value common elements in sets passed as arguments.Exampleset_1 = {'t', 'u', 't', 'o', 'r', 'i', 'a', 'l'} set_2 = {'p', 'o', 'i', 'n', 't'} set_3 = {'t', 'u', 't'} #intersection of two sets print("set1 intersection set2 : ", set_1.intersection(set_2)) # intersection of three sets print("set1 intersection set2 intersection set3 :", set_1.intersection(set_2, set_3))Outputset1 intersection set2 : {'i', 'o', 't'} set1 intersection set2 intersection set3 : {'t'}Explanation Here a search is made ... Read More
In this tutorial, we will be discussing a program to find maximum product subset of an array.For this we will be provided with an array containing positive and negative values. Our task is to find the maximum product for a subset of the array.Example Live Demo#include using namespace std; int maxProductSubset(int a[], int n) { if (n == 1) return a[0]; int max_neg = INT_MIN; int count_neg = 0, count_zero = 0; int prod = 1; for (int i = 0; i < n; i++) { ... Read More
In this article, we will learn about how we can implement isdisjoint() function on set() data type. This function checks whether the sets passed as arguments have any element in common . In case any element is found, False is returned and True otherwise.The isdisjoint() function can take lists, tuples & dictionaries as input arguments in addition to set inputs. THses types are implicitly converted to set type by the Python interpreter.Syntax.isdisjoint()Return valueBoolean True/FalseNow let’s consider an illustration related to the implementationExample#declaration of the sample sets set_1 = {'t', 'u', 't', 'o', 'r', 'i', 'a', 'l'} set_2 = {'p', 'o', ... Read More
Use the justify-content property with value flex-start to align the flex-items at the beginning.ExampleYou can try to run the following code to implement the flex-start value −Live Demo .mycontainer { display: flex; background-color: red; justify-content: flex-start; } .mycontainer > div { background-color: orange; text-align: center; line-height: 60px; font-size: 30px; width: 100px; margin: 5px; } Quiz Q1 Q2 Q3 Q4
Use the justify-content property with value flex-end to align the flex-items at the end.ExampleYou can try to run the following code to implement the flex-end value −Live Demo .mycontainer { display: flex; background-color: red; justify-content: flex-end; } .mycontainer > div { background-color: orange; text-align: center; line-height: 60px; font-size: 30px; width: 100px; margin: 5px; } Quiz Q1 Q2 Q3 Q4
In this article, we will learn about isupper(), islower() ,upper() , lower() function in Python 3.x. or earlier.These are the functions that can be used on strings and related types. They are included in Python Standard Library.All the functions accept no arguments. The isupper() & islower() return boolean values whereas the upper() & lower() function returns strings either in uppercase or lowercase.Now let’s see the implementation using an exampleExamplestring = 'tutorialspoint' # checking for uppercase characters print(string.isupper()) # checking for lowercase characters print(string.islower()) # convert to uppercase characters print(string.upper()) # convert to lowercase characters print(string.lower())OutputFalse True ... Read More
Use the align-items property with value flex-start to align flex items on the top.ExampleYou can try to run the following code to implement the flex-start value −Live Demo .mycontainer { display: flex; height: 300px; background-color: red; align-items: flex-start; } .mycontainer > div { background-color: orange; text-align: center; line-height: 60px; font-size: 30px; width: 100px; margin: 5px; } Quiz Q1 Q2 Q3 Q4