List of usage examples for android.content Intent EXTRA_SUBJECT
String EXTRA_SUBJECT
To view the source code for android.content Intent EXTRA_SUBJECT.
Click Source Link
From source file:com.google.android.apps.paco.FeedbackActivity.java
private void sendEmail(String body, String subject, String userEmail) { userEmail = findAccount(userEmail);/* w w w. ja v a2 s. c om*/ Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); String aEmailList[] = { userEmail }; emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body); emailIntent.setType("plain/text"); startActivity(emailIntent); }
From source file:com.mibr.android.intelligentreminder.INeedToo.java
@Override public Dialog onCreateDialog(int id) { switch (id) { case DIALOG_REMINDER_CONTACTS_SERVICE_FAILED_LICENSING: AlertDialog.Builder buildersvc = new AlertDialog.Builder(this); buildersvc.setMessage(/*from w w w.j a v a 2 s . c o m*/ "The Reminder Contact Service add-on that you've got installed is not a licensed version"); buildersvc.setCancelable(false) .setNeutralButton(R.string.msg_cus, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { String[] mailto = { "info@intelligentreminder.com", "" }; Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "".toString()); sendIntent.putExtra(Intent.EXTRA_TEXT, "".toString()); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, "Send EMail...")); } }).setPositiveButton(R.string.msg_register, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (INeedToo.IS_ANDROID_VERSION) { String uri = getString(R.string.indeedtopayforservice); Intent ii3 = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(ii3); } else { Uri uri = Uri.parse( "http://www.amazon.com/gp/mas/dl/android?p=com.mibr.android.remindercontacts"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } isReminderContactsAvailable = true; iDidReminderContacts = false; } }).setNegativeButton(R.string.msg_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); AlertDialog alert = buildersvc.create(); return alert; case DOING_SAMPLE_NEEDS_DIALOG: if (allItems == null) { return null; } dialogDoingSamples = new Dialog(this); dialogDoingSamples.setOwnerActivity(this); dialogDoingSamples.setContentView(R.layout.ineedvoiceprogress); dialogDoingSamples.setTitle("Working ..."); ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_cancel)).setEnabled(true); ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_ok)).setEnabled(false); ; // dialogDoingSamples.show(); ArrayList stuff = new ArrayList(); stuff.add(dialogDoingSamples); stuff.add(getApplicationContext()); stuff.add(this); stuff.add(getLocationManager()); stuff.add(getDbAdapter()); stuff.add(allItems.get(whereImAtInAllItems)); stuff.add(new Integer(1)); new NeedByVoiceProgress().execute(stuff); return dialogDoingSamples; case DIALOG_SAMPLES: Dialog aDialog = null; AlertDialog.Builder builder2; LayoutInflater inflater2 = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View layout2 = inflater2.inflate(R.layout.ineedsamples, (ViewGroup) findViewById(R.id.hijklmnop)); builder2 = new AlertDialog.Builder(this); builder2.setView(layout2); builder2.setTitle("Build Sample Data Set"); builder2.setPositiveButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { allItems = new ArrayList<ArrayList<String>>(); Boolean doit = false; StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); StringBuilder sb3 = new StringBuilder(); int cnt = 0; Boolean dw = false; ArrayList<String> jdmatchesSS = null; ; sb.append("I need Print Cartridges description HP 28 and 48 "); if (mWalmart != null && mWalmart.isChecked()) { sb.append(" location Walmart "); dw = true; } if (mWalgreens != null && mWalgreens.isChecked()) { sb.append(" location Walgreens "); dw = true; } if (dw) { // they checked something doit = true; jdmatchesSS = new ArrayList<String>(); jdmatchesSS.add(sb.toString()); allItems.add(jdmatchesSS); cnt++; } if (mSevenEleven != null && mSevenEleven.isChecked()) { sb3.append("I need Energy Drink description Red Bull location 7-Eleven "); ArrayList<String> jdmatches = new ArrayList<String>(); jdmatches.add(sb3.toString()); allItems.add(jdmatches); cnt++; doit = true; } if (mStarbucks != null && mStarbucks.isChecked()) { sb2.append("I need Coffee description French Roast location Starbucks"); ArrayList<String> jdmatches = new ArrayList<String>(); jdmatches.add(sb2.toString()); allItems.add(jdmatches); cnt++; doit = true; } if (doit) { whereImAtInAllItems = 0; INeedToo.this.showDialog(DOING_SAMPLE_NEEDS_DIALOG); } } }); mWalmart = (CheckBox) layout2.findViewById(R.id.BuildWalmart); mWalgreens = (CheckBox) layout2.findViewById(R.id.BuildWalgreens); mSevenEleven = (CheckBox) layout2.findViewById(R.id.Build7Eleven); mStarbucks = (CheckBox) layout2.findViewById(R.id.BuildStarbucks); aDialog = builder2.create(); return aDialog; case DIALOG_SPLASH: /* jdd=new Dialog(mContext); jdd.setContentView(R.layout.ineed2splash); jdd.setTitle("W E L C O M E"); */ AlertDialog.Builder builder; LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.ineed2splashv2, (ViewGroup) findViewById(R.id.ScrollView01lmnop2)); builder = new AlertDialog.Builder(this); builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mWantSample != null) { if (mWantSample.isChecked()) { showDialog(DIALOG_SAMPLES); } } } }); builder.setTitle("W E L C O M E"); if (getDbAdapter().thereAreSomeLocationsOnSystem()) { LinearLayout ll = (LinearLayout) layout.findViewById(R.id.CreateDefaultValues); ll.setVisibility(View.INVISIBLE); } else { mWantSample = (CheckBox) layout.findViewById(R.id.BuildDefaultValues); } builder.setView(layout); jdd = builder.create(); //Button butt=(Button)jdd.findViewById(R.id.Button01); /*butt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { jdd.cancel(); } }); */ break; default: return null; } return jdd; }
From source file:com.amaze.filemanager.fragments.preference_fragments.Preffrag.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceUtils.reset();/*from ww w . j av a 2s. c o m*/ // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); final int th1 = Integer.parseInt(sharedPref.getString("theme", "0")); theme = th1 == 2 ? PreferenceUtils.hourOfDay() : th1; findPreference("donate").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { ((com.amaze.filemanager.activities.Preferences) getActivity()).donate(); return false; } }); findPreference("columns").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { final String[] sort = getResources().getStringArray(R.array.columns); MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.title(R.string.gridcolumnno); int current = Integer.parseInt(sharedPref.getString("columns", "-1")); current = current == -1 ? 0 : current; if (current != 0) current = current - 1; a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("columns", "" + (which != 0 ? sort[which] : "" + -1)).commit(); dialog.dismiss(); return true; } }); a.build().show(); return true; } }); findPreference("theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { String[] sort = getResources().getStringArray(R.array.theme); int current = Integer.parseInt(sharedPref.getString("theme", "0")); MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("theme", "" + which).commit(); dialog.dismiss(); restartPC(getActivity()); return true; } }); a.title(R.string.theme); a.build().show(); return true; } }); findPreference("colors").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { ((com.amaze.filemanager.activities.Preferences) getActivity()).selectItem(1); return true; } }); final CheckBx rootmode = (CheckBx) findPreference("rootmode"); rootmode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { boolean b = sharedPref.getBoolean("rootmode", false); if (b) { if (RootTools.isAccessGiven()) { rootmode.setChecked(true); } else { rootmode.setChecked(false); Toast.makeText(getActivity(), getResources().getString(R.string.rootfailure), Toast.LENGTH_LONG).show(); } } else { rootmode.setChecked(false); } return false; } }); // Authors Preference preference4 = (Preference) findPreference("authors"); preference4.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); skin = PreferenceUtils.getPrimaryColorString(sharedPref); int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref)); if (theme == 1) a.theme(Theme.DARK); a.positiveText(R.string.close); a.positiveColor(fab_skin); LayoutInflater layoutInflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = layoutInflater.inflate(R.layout.authors, null); a.customView(view, true); a.title(R.string.authors); a.callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog materialDialog) { materialDialog.cancel(); } @Override public void onNegative(MaterialDialog materialDialog) { } }); /*a.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.cancel(); } });*/ a.build().show(); final Intent intent = new Intent(Intent.ACTION_VIEW); TextView googlePlus1 = (TextView) view.findViewById(R.id.googlePlus1); googlePlus1.setTextColor(Color.parseColor(skin)); TextView googlePlus2 = (TextView) view.findViewById(R.id.googlePlus2); googlePlus2.setTextColor(Color.parseColor(skin)); TextView git1 = (TextView) view.findViewById(R.id.git1); git1.setTextColor(Color.parseColor(skin)); TextView git2 = (TextView) view.findViewById(R.id.git2); git2.setTextColor(Color.parseColor(skin)); googlePlus1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { intent.setData(Uri.parse("https://plus.google.com/u/0/110424067388738907251/")); startActivity(intent); } }); googlePlus2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { intent.setData(Uri.parse("https://plus.google.com/+VishalNehra/")); startActivity(intent); } }); git1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { intent.setData(Uri.parse("https://github.com/arpitkh96")); startActivity(intent); } }); git2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { intent.setData(Uri.parse("https://github.com/vishal0071")); startActivity(intent); } }); // icon credits TextView textView = (TextView) view.findViewById(R.id.icon_credits); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setLinksClickable(true); textView.setText(Html.fromHtml(getActivity().getString(R.string.icon_credits))); return false; } }); // Changelog Preference preference1 = (Preference) findPreference("changelog"); preference1.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity()); if (theme == 1) a.theme(Theme.DARK); a.title(R.string.changelog); a.content(Html.fromHtml(getActivity().getString(R.string.changelog_version_9) + getActivity().getString(R.string.changelog_change_9) + getActivity().getString(R.string.changelog_version_8) + getActivity().getString(R.string.changelog_change_8) + getActivity().getString(R.string.changelog_version_7) + getActivity().getString(R.string.changelog_change_7) + getActivity().getString(R.string.changelog_version_6) + getActivity().getString(R.string.changelog_change_6) + getActivity().getString(R.string.changelog_version_5) + getActivity().getString(R.string.changelog_change_5) + getActivity().getString(R.string.changelog_version_4) + getActivity().getString(R.string.changelog_change_4) + getActivity().getString(R.string.changelog_version_3) + getActivity().getString(R.string.changelog_change_3) + getActivity().getString(R.string.changelog_version_2) + getActivity().getString(R.string.changelog_change_2) + getActivity().getString(R.string.changelog_version_1) + getActivity().getString(R.string.changelog_change_1))); a.negativeText(R.string.close); a.positiveText(R.string.fullChangelog); int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref)); a.positiveColor(fab_skin); a.negativeColor(fab_skin); a.callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog materialDialog) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/arpitkh96/AmazeFileManager/commits/master")); startActivity(intent); } @Override public void onNegative(MaterialDialog materialDialog) { materialDialog.cancel(); } }).build().show(); return false; } }); // Open Source Licenses Preference preference2 = (Preference) findPreference("os"); //Defining dialog layout final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Holo_Light_DialogWhenLarge_NoActionBar); //dialog.setTitle("Open-Source Licenses"); LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE); final View dialog_view = inflater.inflate(R.layout.open_source_licenses, null); dialog.setContentView(dialog_view); preference2.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference arg0) { WebView wv = (WebView) dialog_view.findViewById(R.id.webView1); PreferenceUtils preferenceUtils = new PreferenceUtils(); wv.loadData(PreferenceUtils.LICENCE_TERMS, "text/html", null); dialog.show(); return false; } }); // Feedback Preference preference3 = (Preference) findPreference("feedback"); preference3.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "arpitkh96@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : Amaze File Manager"); Toast.makeText(getActivity(), getActivity().getFilesDir().getPath(), Toast.LENGTH_SHORT).show(); File f = new File(getActivity().getExternalFilesDir("internal"), "log.txt"); if (f.exists()) { emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f)); } startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.feedback))); return false; } }); // rate Preference preference5 = (Preference) findPreference("rate"); preference5.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse("market://details?id=com.amaze.filemanager")); startActivity(intent1); return false; } }); // studio Preference studio = findPreference("studio"); studio.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { COUNT++; if (COUNT >= 5) { if (toast != null) toast.cancel(); toast = Toast.makeText(getActivity(), "Studio Mode : " + COUNT, Toast.LENGTH_SHORT); toast.show(); sharedPref.edit().putInt("studio", Integer.parseInt(Integer.toString(COUNT) + "000")).apply(); } else { sharedPref.edit().putInt("studio", 0).apply(); } return false; } }); // G+ gplus = (CheckBx) findPreference("plus_pic"); gplus.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (gplus.isChecked()) { boolean b = checkGplusPermission(); if (!b) requestGplusPermission(); } return false; } }); if (BuildConfig.IS_VERSION_FDROID) gplus.setEnabled(false); // Colored navigation bar }
From source file:com.kyakujin.android.tagnotepad.ui.NoteListFragment.java
/** * About/* w w w . ja v a2 s . c om*/ */ private void showAboutDialog() { PackageManager pm = getActivity().getPackageManager(); String packageName = getActivity().getPackageName(); String versionName; try { PackageInfo info = pm.getPackageInfo(packageName, 0); versionName = info.versionName; } catch (PackageManager.NameNotFoundException e) { versionName = "N/A"; } SpannableStringBuilder aboutBody = new SpannableStringBuilder(); SpannableString mailAddress = new SpannableString(getString(R.string.mailto)); mailAddress.setSpan(new ClickableSpan() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SENDTO); intent.setData(Uri.parse(getString(R.string.description_mailto))); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.description_mail_subject)); startActivity(intent); } }, 0, mailAddress.length(), 0); aboutBody.append(Html.fromHtml(getString(R.string.about_body, versionName))); aboutBody.append("\n"); aboutBody.append(mailAddress); LayoutInflater layoutInflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); TextView aboutBodyView = (TextView) layoutInflater.inflate(R.layout.fragment_about_dialog, null); aboutBodyView.setText(aboutBody); aboutBodyView.setMovementMethod(LinkMovementMethod.getInstance()); AlertDialog dlg = new AlertDialog.Builder(getActivity()).setTitle(R.string.alert_title_about) .setView(aboutBodyView).setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }).create(); dlg.show(); }
From source file:cn.ttyhuo.view.UserView.java
/** * /*w ww. ja v a2 s.c om*/ * @param context * @param activityTitle Activity?? * @param msgTitle ? * @param msgText ? * @param imgPath ?null */ public static void shareMsg(Context context, String activityTitle, String msgTitle, String msgText, File f) { Intent intent = new Intent(Intent.ACTION_SEND); if (f == null || !f.exists() || !f.isFile()) { intent.setType("text/plain"); // } else { intent.setType("image/png"); Uri u = Uri.fromFile(f); //Uri u = Uri.parse(imgPath); intent.putExtra(Intent.EXTRA_STREAM, u); } intent.putExtra(Intent.EXTRA_SUBJECT, msgTitle); intent.putExtra(Intent.EXTRA_TEXT, msgText); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(Intent.createChooser(intent, activityTitle)); }
From source file:com.rowland.movies.ui.fragments.DetailFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Share a movie trailer case R.id.action_share: // Check for null if (mMovie != null) { // Create an Intent object Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); Trailer trailerShare = null; try { // Retrieve first trailer trailerShare = mMovie.getMovieTrailers().get(0); // Acquire the video url String trailerUrl = String.format(EBaseURlTypes.YOUTUBE_VIDEO_URL.getUrlType(), trailerShare); // Put the trailer url intent.putExtra(Intent.EXTRA_TEXT, trailerUrl); // Put a subject for Intent intent.putExtra(Intent.EXTRA_SUBJECT, mMovie.getOriginalTitle()); // Start the share Intent startActivity(Intent.createChooser(intent, "Share Trailer")); } catch (Exception e) { e.printStackTrace();// w w w . j a va 2 s .c o m } // Do we have any trailers? if (trailerShare == null) { // Inform user of unavailable trailers Snackbar.make(getView(), R.string.status_no_trailers, Snackbar.LENGTH_SHORT); } } return true; default: { return super.onOptionsItemSelected(item); } } }
From source file:com.albedinsky.android.support.intent.EmailIntent.java
/** *///from www . ja v a2 s. co m @NonNull @Override protected Intent onBuild() { final Intent intent = new Intent(Intent.ACTION_SENDTO, createUri(mAddresses)); intent.putExtra(Intent.EXTRA_SUBJECT, mSubject); intent.putExtra(Intent.EXTRA_TEXT, mMessage); if (mCcAddresses != null) { intent.putExtra(Intent.EXTRA_CC, addressesToArray(mCcAddresses)); } if (mBccAddresses != null) { intent.putExtra(Intent.EXTRA_BCC, addressesToArray(mBccAddresses)); } return intent; }
From source file:com.example.julia.popularmovies.details.DetailFragment.java
private void setShareActionProvider(Trailer trailer) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mMovie.getTitle()); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, trailer.getName() + ": " + trailer.getTrailerUrl()); if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(shareIntent); }//from ww w .ja v a2 s .c om }
From source file:alaindc.memenguage.View.MainActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override//from w w w.j a v a2 s .co m public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_home) { } else if (id == R.id.nav_settings) { Intent settingsActivity = new Intent(this, SettingsActivity.class); startActivity(settingsActivity); } else if (id == R.id.nav_send) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.MyDialogTheme); builder.setTitle("Upload Database").setMessage("Are you sure?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { progressDialog.setTitle("Upload"); progressDialog.setMessage("Uploading to server... please wait"); progressDialog.show(); ServerRequests.uploadFile(personId, getApplicationContext().getDatabasePath(Constants.DBNAME), getApplicationContext()); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).create().show(); } else if (id == R.id.nav_get) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.MyDialogTheme); builder.setTitle("Download Database").setMessage("Are you sure?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { progressDialog.setTitle("Download"); progressDialog.setMessage("Downloading from server... please wait"); progressDialog.show(); ServerRequests.downloadFile(personId, getApplicationContext().getDatabasePath(Constants.DBNAME), getApplicationContext()); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }).create().show(); } else if (id == R.id.nav_share) { Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = "Memenguage, the best app on the world! Maybe."; sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Memento mori!"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, "Share via")); } else if (id == R.id.nav_signin) { Intent signinintent = new Intent(this, SignInActivity.class); signinintent.setAction(Constants.SIGNIN_LOGOUT); startActivity(signinintent); } else if (id == R.id.nav_play) { Intent playActivity = new Intent(this, PlayActivity.class); startActivity(playActivity); } else if (id == R.id.nav_stats) { Intent statsActivity = new Intent(this, StatsActivity.class); startActivity(statsActivity); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }