Example usage for android.content Intent CATEGORY_HOME

List of usage examples for android.content Intent CATEGORY_HOME

Introduction

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

Prototype

String CATEGORY_HOME

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

Click Source Link

Document

This is the home activity, that is the first activity that is displayed when the device boots.

Usage

From source file:com.android.mms.ui.MessageUtils.java

private static List<String> getHomes(Context context) {
    MmsLog.d(TAG, "DialogModeActivity.getHomes");

    List<String> names = new ArrayList<String>();
    PackageManager packageManager = context.getPackageManager();
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent,
            PackageManager.MATCH_DEFAULT_ONLY);

    for (ResolveInfo ri : resolveInfo) {
        names.add(ri.activityInfo.packageName);
        MmsLog.d(TAG, "package name=" + ri.activityInfo.packageName + " class name=" + ri.activityInfo.name);
    }// w  w  w. j  av  a2s. co m
    return names;
}

From source file:ua.mkh.settings.full.MainActivity.java

public void update_app() {

    final Dialog dialog = new Dialog(MainActivity.this, android.R.style.Theme_Translucent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_inform);

    // set the custom dialog components - text, image and button

    Button dialogButtone = (Button) dialog.findViewById(R.id.dialogButtonOK);
    TextView text1 = (TextView) dialog.findViewById(R.id.text);
    TextView textB = (TextView) dialog.findViewById(R.id.textBold);
    text1.setText(R.string.update_version);
    textB.setText(R.string.attention);// w  w w.j  a  v  a2  s. co m

    dialogButtone.setTypeface(typefaceRoman);
    text1.setTypeface(typefaceRoman);
    textB.setTypeface(typefaceBold);
    // if button is clicked, close the custom dialog
    dialogButtone.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
            try {
                startActivity(
                        new Intent(Intent.ACTION_VIEW, Uri.parse("yastore://details?id=" + appPackageName)));
            } catch (android.content.ActivityNotFoundException anfe) {
                //startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://khaydarov-studio.bl.ee/fineSettings/")));
            }
            overridePendingTransition(center_to_left, center_to_left2);
            dialog.dismiss();
            Intent intent = new Intent(Intent.ACTION_MAIN);
            intent.addCategory(Intent.CATEGORY_HOME);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);

        }

    });
    dialog.show();
}

From source file:com.example.sensingapp.SensingApp.java

/** Called when the activity is first created. */
@Override//from   www  .  ja v a2s  .c o  m
public void onCreate(Bundle savedInstanceState) {
    int i;
    Location location = null;

    super.onCreate(savedInstanceState);

    if (android.os.Build.VERSION.SDK_INT > 9) {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }

    try {
        Class.forName("android.os.AsyncTask");
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }

    m_smSurScan = (SensorManager) getSystemService(SENSOR_SERVICE);

    PackageManager pm = getPackageManager();
    m_riHome = pm.resolveActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME), 0);

    m_nBufferSize = AudioRecord.getMinBufferSize(m_nAudioSampleRate, AudioFormat.CHANNEL_IN_STEREO,
            AudioFormat.ENCODING_PCM_16BIT);

    m_tmCellular = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

    checkSensorAvailability();

    //Get Existing Project Name and Existing User Name
    preconfigSetting();

    /* When the power button is pressed and the screen goes off, the sensors will stop work by default,
     * Here keep the CPU on to keep sensor alive and also use SCREEN_OFF notification to re-enable GPS/WiFi
     */
    PowerManager pwrManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
    m_wakeLock = pwrManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
    IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
    filter.addAction(Intent.ACTION_SCREEN_OFF);

    registerReceiver(m_ScreenOffReceiver, filter);

    show_screen1();
}

From source file:com.android.tv.MainActivity.java

@Override
public void onBackPressed() {
    // The activity should be returned to the caller of this activity
    // when the mSource is not null.
    if (!mOverlayManager.getSideFragmentManager().isActive() && isPlaying() && mSource == null) {
        // If back key would exit TV app,
        // show McLauncher instead so we can get benefit of McLauncher's shyMode.
        Intent startMain = new Intent(Intent.ACTION_MAIN);
        startMain.addCategory(Intent.CATEGORY_HOME);
        startActivity(startMain);//from   w w  w.ja va  2  s . c om
    } else {
        super.onBackPressed();
    }
}

From source file:com.sentaroh.android.SMBSync2.ActivityMain.java

private void setUiDisabled() {
    util.addDebugMsg(1, "I", "setUiDisabled entered");
    enableMainUi = false;//from  w ww.ja v a 2 s.c om

    setOnKeyCallBackListener(new CallBackListener() {
        public boolean onCallBack(Context c, Object o1, Object[] o2) {
            Intent in = new Intent();
            in.setAction(Intent.ACTION_MAIN);
            in.addCategory(Intent.CATEGORY_HOME);
            startActivity(in);
            return true;
        }
    });

    if (!mGp.syncTaskAdapter.isShowCheckBox())
        setProfileContextButtonNormalMode();
    else
        setProfileContextButtonSelectMode();

    if (!mGp.syncHistoryAdapter.isShowCheckBox())
        setHistoryContextButtonNormalMode();
    else
        setHistoryContextButtonSelectMode();

    refreshOptionMenu();
}