Skip to content

Instantly share code, notes, and snippets.

Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"velmurugan@androidtoppers.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "Hi");
email.putExtra(Intent.EXTRA_TEXT, "Hi,This is Test");
email.setType("text/plain");
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"velmurugan@androidtoppers.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "Hi");
email.putExtra(Intent.EXTRA_TEXT, "Hi,This is Test");
email.setType("text/plain");
final Dialog dialog = new Dialog(Custom_chooser.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
WindowManager.LayoutParams WMLP = dialog.getWindow().getAttributes();
WMLP.gravity = Gravity.CENTER;
dialog.getWindow().setAttributes(WMLP);
dialog.getWindow().setBackgroundDrawable(
new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setCanceledOnTouchOutside(true);
dialog.setContentView(R.layout.about_dialog);
dialog.show();
List<ResolveInfo> launchables=pm.queryIntentActivities(email, 0);
Collections.sort(launchables,newResolveInfo.DisplayNameComparator(pm));
adapter=new AppAdapter(pm, launchables);
lv.setAdapter(adapter);
ResolveInfo launchable=adapter.getItem(position);
ActivityInfo activity=launchable.activityInfo;
ComponentName name=new ComponentName(activity.applicationInfo.packageName,activity.name);
email.addCategory(Intent.CATEGORY_LAUNCHER);
email.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
email.setComponent(name);
startActivity(email);
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigationview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="@color/bgBottomNavigation"
android:foreground="?android:attr/selectableItemBackground"
app:itemTextColor="@android:color/white"
app:itemIconTint="@android:color/white"
app:menu="@menu/navigation_menu"
android:layout_gravity="bottom">
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/item1"
android:icon="@drawable/ic_store_white_24dp"
android:title="@string/item_1"></item>
<item android:id="@+id/item2"
android:icon="@drawable/ic_favorite_white_24dp"
android:title="@string/item_2"></item>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.velmurugan.bottomnativation.MainActivity">
<FrameLayout
android:id="@+id/frame_layout"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="#f8fa2941" />
<item android:color="@android:color/white" />
</selector>