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:org.alfresco.mobile.android.application.security.PassCodeActivity.java

@Override
public void onBackPressed() {
    // We go back to the device home.
    Intent startMain = new Intent(Intent.ACTION_MAIN);
    startMain.addCategory(Intent.CATEGORY_HOME);
    startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(startMain);//from www.  j  av a2  s.c om
}

From source file:com.gigathinking.simpleapplock.UnlockWithGesture.java

@Override
public void onBackPressed() {
    if (changeLock) {
        setResult(AppLockApplication.RESULT_NOT_OK);
        finish();//from  w w  w .  ja  va2  s  .  c o  m
        return;
    }
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
}

From source file:cn.newgxu.android.notty.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.dark_theme:
        ThemeUtils.apply(this, ThemeUtils.DARK_THEME);
        break;/*from   w  w  w.j  a v  a 2  s  .c  o  m*/
    case R.id.light_theme:
        ThemeUtils.apply(this, ThemeUtils.LIGHT_THEME);
        break;
    case R.id.refresh:
        Intent intent = new Intent(this, FetchService.class);
        String[] uris = { C.BASE_URI + C.NOTICES, C.BASE_URI + C.USERS };
        intent.putExtra("uris", uris);
        //         TODO: ???
        intent.putExtra(C.URI, C.DOMAIN + "/info/notices?type=4&count=50");
        startService(intent);
        break;
    case R.id.logout:
        Intent i = new Intent(Intent.ACTION_MAIN);
        i.addCategory(Intent.CATEGORY_HOME);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(i);
        break;
    case R.id.about:
        AboutBoxDialogFragment about = new AboutBoxDialogFragment();
        about.show(fm, "about");
        break;
    default:
        break;
    }
    return true;
}

From source file:com.anykey.balala.activity.MainActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addCategory(Intent.CATEGORY_HOME);
        startActivity(intent);//from  ww  w .ja v  a  2 s .c o m
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.quickcar.thuexe.UI.ListPassengerActivity.java

private void initComponents() {
    imgMenu = (ImageView) findViewById(R.id.img_menu);
    btnBack = (ImageView) findViewById(R.id.img_back);
    btnBack.setOnClickListener(new View.OnClickListener() {
        @Override//from  w ww.  ja v a 2  s .c  o m
        public void onClick(View v) {
            if (doubleBackToExitPressedOnce) {
                Intent intent = new Intent(Intent.ACTION_MAIN);
                intent.addCategory(Intent.CATEGORY_HOME);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
            } else {
                Toast.makeText(mContext, getResources().getString(R.string.notice_close_app),
                        Toast.LENGTH_SHORT).show();
                doubleBackToExitPressedOnce = true;
                new Handler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        doubleBackToExitPressedOnce = false;
                    }
                }, 2000);
            }
        }
    });
    imgMenu.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            PopupMenu popup = new PopupMenu(ListPassengerActivity.this, v);
            MenuInflater inflater = popup.getMenuInflater();
            inflater.inflate(R.menu.intro_menu_owner, popup.getMenu());
            popup.show();
            popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    switch (item.getItemId()) {
                    case R.id.edit_user:
                        Intent intent = new Intent(ListPassengerActivity.this, EditOwnerActivity.class);
                        startActivity(intent);
                        return true;
                    case R.id.share_social:
                        showDialogShareSocial();
                        return true;
                    case R.id.change_role:
                        showDialogSwitchUser();
                        return true;
                    }
                    return false;
                }
            });
        }
    });
    if (!preference.getRegisterToken()) {
        dialog = new ProgressDialog(mContext);
        dialog.setMessage("?ang ti d liu");
        dialog.setCanceledOnTouchOutside(false);
        dialog.setCancelable(false);
        dialog.show();
        registerToken(preference.getToken());
    }
    viewPager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(viewPager);

    tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);
    setupTabIcons();
}

From source file:edu.uwp.alga.MainActivity.java

@Override
public void onBackPressed() {
    super.onBackPressed();
    if (mViewPager.getCurrentItem() == 0) {
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_HOME);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);//***Change Here***
        startActivity(intent);/*from   w w w .  j  av  a 2  s  .  c o m*/
        finish();
        System.exit(0);
    }

}

From source file:com.zetcheck.MenuActivity.java

@Override
public void onBackPressed() {
    if (mViewPager.getCurrentItem() != 1) {
        mViewPager.setCurrentItem(1);/*from  w  w  w  .  j  av  a2 s .  c om*/
        return;
    }
    Intent intent1 = new Intent(Intent.ACTION_MAIN);
    intent1.addCategory(Intent.CATEGORY_HOME);
    intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent1);
}

From source file:com.koma.music.main.MainActivity.java

private void backToHome() {
    Intent launcher = new Intent(Intent.ACTION_MAIN);
    launcher.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    launcher.addCategory(Intent.CATEGORY_HOME);
    startActivity(launcher);//from  w w w.j a v  a 2s.c  o m
}

From source file:ie.ucd.www.bee.MainActivity.java

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    if (requestCode == INTERNET_REQUEST_CODE || requestCode == ACCESS_NETWORK_STATE_REQUEST_CODE)
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            // Permission Granted

        } else {/*from w  w w. ja  va  2 s  .com*/
            // Permission Denied
            new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE).setTitleText("Warning")
                    .setContentText("You must authorize BeeBia the necessary permissions.")
                    .setConfirmText("Exit")
                    .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
                        @Override
                        public void onClick(SweetAlertDialog sweetAlertDialog) {
                            sweetAlertDialog.dismissWithAnimation();
                            Intent intent = new Intent(Intent.ACTION_MAIN);
                            intent.addCategory(Intent.CATEGORY_HOME);
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            startActivity(intent);
                        }
                    }).show();
        }
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

From source file:com.oakesville.mythling.MainActivity.java

public void onBackPressed() {
    if (EpgActivity.class.getName().equals(backTo) || FireTvEpgActivity.class.getName().equals(backTo)) {
        Intent a = new Intent(Intent.ACTION_MAIN);
        a.addCategory(Intent.CATEGORY_HOME);
        a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(a);//w  ww  .  j a  va  2  s.  c o m
    } else {
        super.onBackPressed();
    }
}