Example usage for android.content Intent EXTRA_SUBJECT

List of usage examples for android.content Intent EXTRA_SUBJECT

Introduction

In this page you can find the example usage for android.content Intent EXTRA_SUBJECT.

Prototype

String EXTRA_SUBJECT

To view the source code for android.content Intent EXTRA_SUBJECT.

Click Source Link

Document

A constant string holding the desired subject line of a message.

Usage

From source file:com.daiv.android.twitter.ui.drawer_activities.DrawerActivity.java

private void showContactUsDialog() {
    new AlertDialog.Builder(context).setItems(new CharSequence[] { "Twitter", "Google+", "Email" },
            new DialogInterface.OnClickListener() {
                @Override/* w  w  w .j a v  a  2  s  . com*/
                public void onClick(DialogInterface dialogInterface, int i) {
                    if (i == 0) {
                        final Intent tweet = new Intent(context, ComposeActivity.class);
                        new AlertDialog.Builder(context)
                                .setItems(new CharSequence[] { "@TestAndroid", "@daiv" },
                                        new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface dialogInterface, int i) {
                                                if (i == 0) {
                                                    tweet.putExtra("user", "@TestAndroid");
                                                } else {
                                                    tweet.putExtra("user", "@daiv");
                                                }
                                                startActivity(tweet);
                                            }
                                        })
                                .create().show();
                    } else if (i == 1) {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://goo.gl/KCXlZk")));
                    } else {
                        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

                        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                                new String[] { "support@daivapps.com" });
                        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test (Classic)");
                        emailIntent.setType("plain/text");

                        startActivity(emailIntent);
                    }
                }
            }).create().show();
}

From source file:com.androzic.MapFragment.java

@Override
public boolean onMenuItemSelected(MenuBuilder builder, MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_information: {
        FragmentManager manager = getFragmentManager();
        LocationInfo dialog = new LocationInfo(application.getMapCenter());
        dialog.show(manager, "dialog");
        return true;
    }// w  ww .j  a v  a 2  s  .  co  m
    case R.id.action_share: {
        Intent i = new Intent(android.content.Intent.ACTION_SEND);
        i.setType("text/plain");
        i.putExtra(Intent.EXTRA_SUBJECT, R.string.currentloc);
        double[] loc = application.getMapCenter();
        String spos = StringFormatter.coordinates(" ", loc[0], loc[1]);
        i.putExtra(Intent.EXTRA_TEXT, spos);
        startActivity(Intent.createChooser(i, getString(R.string.menu_share)));
        return true;
    }
    case R.id.action_view_elsewhere: {
        double[] sloc = application.getMapCenter();
        String geoUri = "geo:" + Double.toString(sloc[0]) + "," + Double.toString(sloc[1]);
        Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoUri));
        startActivity(intent);
        return true;
    }
    case R.id.action_copy_location: {
        double[] cloc = application.getMapCenter();
        String cpos = StringFormatter.coordinates(" ", cloc[0], cloc[1]);
        Clipboard.copy(getActivity(), cpos);
        return true;
    }
    case R.id.action_paste_location: {
        String text = Clipboard.paste(getActivity());
        try {
            double c[] = CoordinateParser.parse(text);
            if (!Double.isNaN(c[0]) && !Double.isNaN(c[1])) {
                boolean mapChanged = application.setMapCenter(c[0], c[1], true, true, false);
                if (mapChanged)
                    map.updateMapInfo();
                map.updateMapCenter();
                following = false;
                map.setFollowing(false);
            }
        } catch (IllegalArgumentException e) {
        }
        return true;
    }
    case R.id.action_add_to_route: {
        Waypoint wpt = application.getWaypoint(waypointSelected);
        application.routeEditingWaypoints
                .push(application.editingRoute.addWaypoint(wpt.name, wpt.latitude, wpt.longitude));
        refreshMap();
        return true;
    }
    case R.id.action_navigate: {
        application.navigationService.setRouteWaypoint(waypointSelected);
        return true;
    }
    case R.id.action_mapobject_navigate: {
        application.startNavigation(application.getMapObject(mapObjectSelected));
        return true;
    }
    }
    return false;
}

From source file:com.klinker.android.twitter.ui.drawer_activities.DrawerActivity.java

private void showContactUsDialog() {
    new AlertDialog.Builder(context).setItems(new CharSequence[] { "Twitter", "Google+", "Email" },
            new DialogInterface.OnClickListener() {
                @Override//from w  ww  .j  a  v  a 2  s .  c o m
                public void onClick(DialogInterface dialogInterface, int i) {
                    if (i == 0) {
                        final Intent tweet = new Intent(context, ComposeActivity.class);
                        new AlertDialog.Builder(context)
                                .setItems(new CharSequence[] { "@TalonAndroid", "@lukeklinker" },
                                        new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface dialogInterface, int i) {
                                                if (i == 0) {
                                                    tweet.putExtra("user", "@TalonAndroid");
                                                } else {
                                                    tweet.putExtra("user", "@lukeklinker");
                                                }
                                                startActivity(tweet);
                                            }
                                        })
                                .create().show();
                    } else if (i == 1) {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://goo.gl/KCXlZk")));
                    } else {
                        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

                        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                                new String[] { "support@klinkerapps.com" });
                        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Talon (Classic)");
                        emailIntent.setType("plain/text");

                        startActivity(emailIntent);
                    }
                }
            }).create().show();
}

From source file:com.klinker.android.twitter.activities.drawer_activities.DrawerActivity.java

private void showContactUsDialog() {
    new AlertDialog.Builder(context).setItems(new CharSequence[] { "Twitter", "Google+", "Email" },
            new DialogInterface.OnClickListener() {
                @Override/*  w  w  w.  jav a  2s  .c o m*/
                public void onClick(DialogInterface dialogInterface, int i) {
                    if (i == 0) {
                        final Intent tweet = new Intent(context, ComposeActivity.class);
                        new AlertDialog.Builder(context)
                                .setItems(new CharSequence[] { "@TalonAndroid", "@lukeklinker" },
                                        new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface dialogInterface, int i) {
                                                if (i == 0) {
                                                    tweet.putExtra("user", "@TalonAndroid");
                                                } else {
                                                    tweet.putExtra("user", "@lukeklinker");
                                                }
                                                startActivity(tweet);
                                            }
                                        })
                                .create().show();
                    } else if (i == 1) {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://goo.gl/KCXlZk")));
                    } else {
                        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

                        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                                new String[] { "luke@klinkerapps.com" });
                        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Talon (Classic)");
                        emailIntent.setType("plain/text");

                        startActivity(emailIntent);
                    }
                }
            }).create().show();
}

From source file:activities.PaintActivity.java

private void invokeApplication(String packageName, Resources resources) {

    int requestCode = 0;
    Log.d("DialogShare", "Seleccionado ... " + packageName);
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.setType("image/*");

    shareIntent.setPackage(packageName);

    //Image/*from  w  ww .j  ava  2s.c o  m*/
    Bitmap bitmap = painter.getImageBitmap();

    if ((uriTempImage = PaintUtility.saveTempPhoto(this, bitmap)) == null)
        Toast.makeText(this, "Error al crear imagonen ", Toast.LENGTH_SHORT).show();

    shareIntent.putExtra(Intent.EXTRA_STREAM, uriTempImage);

    if (packageName.contains("twitter")) {
        shareIntent.putExtra(Intent.EXTRA_TEXT, resources.getString(string.sharecontent_twitter_text));
        requestCode = RS_CODE_SHARE_TWITTER;

    } else if (packageName.contains("facebook")) {
        // Warning: Facebook IGNORES our text. They say "These fields are intended for users to express themselves. Pre-filling these fields erodes the authenticity of the user voice."
        // One workaround is to use the Facebook SDK to post, but that doesn't allow the user to choose how they want to share. We can also make a custom landing page, and the link
        // will show the <meta content ="..."> text from that page with our link in Facebook.
        shareIntent.putExtra(Intent.EXTRA_TEXT, resources.getString(string.sharecontent_fb_text));
        requestCode = RS_CODE_SHARE_FB;
    } else if (packageName.contains("gm")) {

        shareIntent.putExtra(Intent.EXTRA_TEXT, resources.getString(string.sharecontent_email_text));
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, resources.getString(string.sharecontent_subject));
        shareIntent.setType("message/rfc822");
        requestCode = RS_CODE_SHARE_GMAIL;
    }

    startActivityForResult(shareIntent, requestCode);
}

From source file:org.getlantern.firetweet.util.Utils.java

public static Intent createStatusShareIntent(final Context context, final ParcelableStatus status) {
    final Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_SUBJECT, getStatusShareSubject(context, status));
    intent.putExtra(Intent.EXTRA_TEXT, getStatusShareText(context, status));
    intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    return intent;
}

From source file:com.irccloud.android.activity.MainActivity.java

private void setFromIntent(Intent intent) {
    launchBid = -1;/*from  w  ww . java2 s . co  m*/
    launchURI = null;

    if (NetworkConnection.getInstance().ready)
        setIntent(new Intent(this, MainActivity.class));

    if (intent.hasExtra("bid")) {
        int new_bid = intent.getIntExtra("bid", 0);
        if (NetworkConnection.getInstance().ready
                && NetworkConnection.getInstance().getState() == NetworkConnection.STATE_CONNECTED
                && BuffersDataSource.getInstance().getBuffer(new_bid) == null) {
            Crashlytics.log(Log.WARN, "IRCCloud", "Invalid bid requested by launch intent: " + new_bid);
            Notifications.getInstance().deleteNotificationsForBid(new_bid);
            if (excludeBIDTask != null)
                excludeBIDTask.cancel(true);
            excludeBIDTask = new ExcludeBIDTask();
            excludeBIDTask.execute(new_bid);
            return;
        } else if (BuffersDataSource.getInstance().getBuffer(new_bid) != null) {
            Crashlytics.log(Log.DEBUG, "IRCCloud", "Found BID, switching buffers");
            if (buffer != null && buffer.bid != new_bid)
                backStack.add(0, buffer.bid);
            buffer = BuffersDataSource.getInstance().getBuffer(new_bid);
            server = ServersDataSource.getInstance().getServer(buffer.cid);
        } else {
            Crashlytics.log(Log.DEBUG, "IRCCloud", "BID not found, will try after reconnecting");
            launchBid = new_bid;
        }
    }

    if (intent.getData() != null && intent.getData().getScheme() != null
            && intent.getData().getScheme().startsWith("irc")) {
        if (open_uri(intent.getData())) {
            return;
        } else {
            launchURI = intent.getData();
            buffer = null;
            server = null;
        }
    } else if (intent.hasExtra("cid")) {
        if (buffer == null) {
            buffer = BuffersDataSource.getInstance().getBufferByName(intent.getIntExtra("cid", 0),
                    intent.getStringExtra("name"));
            if (buffer != null) {
                server = ServersDataSource.getInstance().getServer(intent.getIntExtra("cid", 0));
            }
        }
    }

    if (buffer == null) {
        server = null;
    } else {
        if (intent.hasExtra(Intent.EXTRA_STREAM)) {
            String type = getContentResolver().getType((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM));
            if (type != null && type.startsWith("image/")
                    && (!NetworkConnection.getInstance().uploadsAvailable()
                            || PreferenceManager.getDefaultSharedPreferences(this)
                                    .getString("image_service", "IRCCloud").equals("imgur"))) {
                new ImgurRefreshTask((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM)).execute((Void) null);
            } else {
                fileUploadTask = new FileUploadTask((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM), this);
                fileUploadTask.execute((Void) null);
            }
        }

        if (intent.hasExtra(Intent.EXTRA_TEXT)) {
            if (intent.hasExtra(Intent.EXTRA_SUBJECT))
                buffer.draft = intent.getStringExtra(Intent.EXTRA_SUBJECT) + " ("
                        + intent.getStringExtra(Intent.EXTRA_TEXT) + ")";
            else
                buffer.draft = intent.getStringExtra(Intent.EXTRA_TEXT);
        }
    }

    if (buffer == null) {
        launchBid = intent.getIntExtra("bid", -1);
    } else {
        onBufferSelected(buffer.bid);
    }
}

From source file:fiskinfoo.no.sintef.fiskinfoo.MyToolsFragment.java

private void generateAndSendGeoJsonToolReport() {
    FiskInfoUtility fiskInfoUtility = new FiskInfoUtility();
    JSONObject featureCollection = new JSONObject();

    try {//from   ww w  .j a v  a 2s  .  c  o  m
        Set<Map.Entry<String, ArrayList<ToolEntry>>> tools = user.getToolLog().myLog.entrySet();
        JSONArray featureList = new JSONArray();

        for (final Map.Entry<String, ArrayList<ToolEntry>> dateEntry : tools) {
            for (final ToolEntry toolEntry : dateEntry.getValue()) {
                if (toolEntry.getToolStatus() == ToolEntryStatus.STATUS_RECEIVED
                        || toolEntry.getToolStatus() == ToolEntryStatus.STATUS_REMOVED) {
                    continue;
                }

                toolEntry.setToolStatus(toolEntry.getToolStatus() == ToolEntryStatus.STATUS_REMOVED_UNCONFIRMED
                        ? ToolEntryStatus.STATUS_REMOVED_UNCONFIRMED
                        : ToolEntryStatus.STATUS_SENT_UNCONFIRMED);
                JSONObject gjsonTool = toolEntry.toGeoJson(mGpsLocationTracker);
                featureList.put(gjsonTool);
            }
        }

        if (featureList.length() == 0) {
            Toast.makeText(getActivity(), getString(R.string.no_changes_to_report), Toast.LENGTH_LONG).show();

            return;
        }

        user.writeToSharedPref(getActivity());
        featureCollection.put("features", featureList);
        featureCollection.put("type", "FeatureCollection");
        featureCollection.put("crs", JSONObject.NULL);
        featureCollection.put("bbox", JSONObject.NULL);

        String toolString = featureCollection.toString(4);

        if (fiskInfoUtility.isExternalStorageWritable()) {
            fiskInfoUtility.writeMapLayerToExternalStorage(getActivity(), toolString.getBytes(),
                    getString(R.string.tool_report_file_name), getString(R.string.format_geojson), null, false);
            String directoryPath = Environment
                    .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString();
            String fileName = directoryPath + "/FiskInfo/api_setting.json";
            File apiSettingsFile = new File(fileName);
            String recipient = null;

            if (apiSettingsFile.exists()) {
                InputStream inputStream;
                InputStreamReader streamReader;
                JsonReader jsonReader;

                try {
                    inputStream = new BufferedInputStream(new FileInputStream(apiSettingsFile));
                    streamReader = new InputStreamReader(inputStream, "UTF-8");
                    jsonReader = new JsonReader(streamReader);

                    jsonReader.beginObject();
                    while (jsonReader.hasNext()) {
                        String name = jsonReader.nextName();
                        if (name.equals("email")) {
                            recipient = jsonReader.nextString();
                        } else {
                            jsonReader.skipValue();
                        }
                    }
                    jsonReader.endObject();
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IllegalStateException e) {
                    e.printStackTrace();
                }
            }

            recipient = recipient == null ? getString(R.string.tool_report_recipient_email) : recipient;
            String[] recipients = new String[] { recipient };
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("plain/plain");

            String toolIds;
            StringBuilder sb = new StringBuilder();

            sb.append("Redskapskoder:\n");

            for (int i = 0; i < featureList.length(); i++) {
                sb.append(Integer.toString(i + 1));
                sb.append(": ");
                sb.append(featureList.getJSONObject(i).getJSONObject("properties").getString("ToolId"));
                sb.append("\n");
            }

            toolIds = sb.toString();

            intent.putExtra(Intent.EXTRA_EMAIL, recipients);
            intent.putExtra(Intent.EXTRA_TEXT, toolIds);
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.tool_report_email_header));
            File file = new File(
                    Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath()
                            + "/FiskInfo/Redskapsrapport.geojson");
            Uri uri = Uri.fromFile(file);
            intent.putExtra(Intent.EXTRA_STREAM, uri);

            startActivity(Intent.createChooser(intent, getString(R.string.send_tool_report_intent_header)));

        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.androzic.MapActivity.java

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menuSearch:
        onSearchRequested();//w w  w.  j  av a2 s  . c  o  m
        return true;
    case R.id.menuAddWaypoint: {
        double[] loc = application.getMapCenter();
        Waypoint waypoint = new Waypoint("", "", loc[0], loc[1]);
        waypoint.date = Calendar.getInstance().getTime();
        int wpt = application.addWaypoint(waypoint);
        waypoint.name = "WPT" + wpt;
        application.saveDefaultWaypoints();
        map.update();
        return true;
    }
    case R.id.menuNewWaypoint:
        startActivityForResult(new Intent(this, WaypointProperties.class).putExtra("INDEX", -1),
                RESULT_SAVE_WAYPOINT);
        return true;
    case R.id.menuProjectWaypoint:
        startActivityForResult(new Intent(this, WaypointProject.class), RESULT_SAVE_WAYPOINT);
        return true;
    case R.id.menuManageWaypoints:
        startActivityForResult(new Intent(this, WaypointList.class), RESULT_MANAGE_WAYPOINTS);
        return true;
    case R.id.menuLoadWaypoints:
        startActivityForResult(new Intent(this, WaypointFileList.class), RESULT_LOAD_WAYPOINTS);
        return true;
    case R.id.menuManageTracks:
        startActivityForResult(new Intent(this, TrackList.class), RESULT_MANAGE_TRACKS);
        return true;
    case R.id.menuExportCurrentTrack:
        FragmentManager fm = getSupportFragmentManager();
        TrackExportDialog trackExportDialog = new TrackExportDialog(locationService);
        trackExportDialog.show(fm, "track_export");
        return true;
    case R.id.menuExpandCurrentTrack:
        new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle(R.string.warning)
                .setMessage(R.string.msg_expandcurrenttrack)
                .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (application.currentTrackOverlay != null) {
                            Track track = locationService.getTrack();
                            track.show = true;
                            application.currentTrackOverlay.setTrack(track);
                        }
                    }
                }).setNegativeButton(R.string.no, null).show();
        return true;
    case R.id.menuClearCurrentTrack:
        new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle(R.string.warning)
                .setMessage(R.string.msg_clearcurrenttrack)
                .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (application.currentTrackOverlay != null)
                            application.currentTrackOverlay.clear();
                        locationService.clearTrack();
                    }
                }).setNegativeButton(R.string.no, null).show();
        return true;
    case R.id.menuManageRoutes:
        startActivityForResult(new Intent(this, RouteList.class).putExtra("MODE", RouteList.MODE_MANAGE),
                RESULT_MANAGE_ROUTES);
        return true;
    case R.id.menuStartNavigation:
        if (application.getRoutes().size() > 1) {
            startActivity(new Intent(this, RouteList.class).putExtra("MODE", RouteList.MODE_START));
        } else {
            startActivity(new Intent(this, RouteStart.class).putExtra("INDEX", 0));
        }
        return true;
    case R.id.menuNavigationDetails:
        startActivity(new Intent(this, RouteDetails.class)
                .putExtra("index", application.getRouteIndex(navigationService.navRoute))
                .putExtra("nav", true));
        return true;
    case R.id.menuNextNavPoint:
        navigationService.nextRouteWaypoint();
        return true;
    case R.id.menuPrevNavPoint:
        navigationService.prevRouteWaypoint();
        return true;
    case R.id.menuStopNavigation: {
        navigationService.stopNavigation();
        return true;
    }
    case R.id.menuHSI:
        startActivity(new Intent(this, HSIActivity.class));
        return true;
    case R.id.menuInformation:
        startActivity(new Intent(this, Information.class));
        return true;
    case R.id.menuMapInfo:
        startActivity(new Intent(this, MapInformation.class));
        return true;
    case R.id.menuCursorMaps:
        startActivityForResult(new Intent(this, MapList.class).putExtra("pos", true),
                RESULT_LOAD_MAP_ATPOSITION);
        return true;
    case R.id.menuAllMaps:
        startActivityForResult(new Intent(this, MapList.class), RESULT_LOAD_MAP);
        return true;
    case R.id.menuShare:
        Intent i = new Intent(android.content.Intent.ACTION_SEND);
        i.setType("text/plain");
        i.putExtra(Intent.EXTRA_SUBJECT, R.string.currentloc);
        double[] sloc = application.getMapCenter();
        String spos = StringFormatter.coordinates(application.coordinateFormat, " ", sloc[0], sloc[1]);
        i.putExtra(Intent.EXTRA_TEXT, spos);
        startActivity(Intent.createChooser(i, getString(R.string.menu_share)));
        return true;
    case R.id.menuCopyLocation: {
        ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        double[] cloc = application.getMapCenter();
        String cpos = StringFormatter.coordinates(application.coordinateFormat, " ", cloc[0], cloc[1]);
        clipboard.setText(cpos);
        return true;
    }
    case R.id.menuPasteLocation: {
        ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        if (clipboard.hasText()) {
            String q = clipboard.getText().toString();
            try {
                double c[] = CoordinateParser.parse(q);
                if (!Double.isNaN(c[0]) && !Double.isNaN(c[1])) {
                    boolean mapChanged = application.setMapCenter(c[0], c[1], true, false);
                    if (mapChanged)
                        map.updateMapInfo();
                    map.update();
                    map.setFollowing(false);
                }
            } catch (IllegalArgumentException e) {
            }
        }
        return true;
    }
    case R.id.menuSetAnchor:
        if (showDistance > 0) {
            application.distanceOverlay.setAncor(application.getMapCenter());
            application.distanceOverlay.setEnabled(true);
        }
        return true;
    case R.id.menuPreferences:
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
            startActivity(new Intent(this, Preferences.class));
        } else {
            startActivity(new Intent(this, PreferencesHC.class));
        }
        return true;
    }
    return false;
}