Example usage for android.content Intent putExtras

List of usage examples for android.content Intent putExtras

Introduction

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

Prototype

public @NonNull Intent putExtras(@NonNull Bundle extras) 

Source Link

Document

Add a set of extended data to the intent.

Usage

From source file:br.com.android.cotuca.toptask.Activitys.MSimplesActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // A actionBar do menu deve abrir e fechar.
    // ActionBarDrawerToggle vai fazer isso.
    if (mDrawerToggle.onOptionsItemSelected(item)) {
        return true;
    }/* w w  w .j  a  v  a 2 s .  co  m*/

    switch (item.getItemId()) {
    case R.id.action_add:
        Intent i = new Intent(this, CadastroTarefa.class);

        Bundle dados = new Bundle();
        dados.putInt(ContratoTarefas.Colunas.PROJETO, idProjetoSelecionado);
        dados.putInt(ContratoTarefas.Colunas.DONO, idUsuarioSelecionado);
        dados.putInt(Tags.B_ACAO, Tags.ACAO_CADASTRO);

        i.putExtras(dados);
        startActivity(i);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.amytech.android.library.views.imagechooser.api.ImageChooserManager.java

private String takePicture() throws Exception {
    checkDirectory();/*from   ww w.ja  va2 s  .c o  m*/
    try {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        filePathOriginal = FileUtils.getDirectory(foldername) + File.separator
                + Calendar.getInstance().getTimeInMillis() + ".jpg";
        intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(filePathOriginal)));
        if (extras != null) {
            intent.putExtras(extras);
        }
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        throw new Exception("Activity not found");
    }
    return filePathOriginal;
}

From source file:com.petrodevelopment.dice.external.Router.java

/**
 * Open a URL using the operating system's configuration (such as opening a link to Chrome or a video to YouTube)
 * @param url The URL; for example, "http://www.youtube.com/watch?v=oHg5SJYRHA0"
 * @param extras The {@link Bundle} which contains the extras to be assigned to the generated {@link Intent}
 * @param context The context which is used in the generated {@link Intent}
 *///from  ww  w.  j  ava  2  s. com
public void openExternal(String url, Bundle extras, Context context) {
    if (context == null) {
        throw new ContextNotProvided("You need to supply a context for Router " + this.toString());
    }
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    this.addFlagsToIntent(intent, context);
    if (extras != null) {
        intent.putExtras(extras);
    }
    context.startActivity(intent);
}

From source file:at.jclehner.rxdroid.NotificationReceiver.java

private PendingIntent createOperation(Bundle extras) {
    Intent intent = new Intent(mContext, NotificationReceiver.class);
    intent.setAction(Intent.ACTION_MAIN);

    if (extras != null)
        intent.putExtras(extras);

    return PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
}

From source file:com.deemsysinc.gpsmobiletracking.DashboardActivity.java

public void onItemClick(int mPosition) {

    Intent intent = new Intent(DashboardActivity.this, LiveTrack.class);
    Bundle b = new Bundle();
    //    System.out.println("Position passed from dashboard activity:::"+vehicle_regno);
    System.out.println("Position passed from dashboard activity:fghfgh::" + route_num);
    //  Bundle b1=new Bundle();
    b.putString("vehicleregnum", vehicle_regno);
    b.putString("routenum", route_num);

    intent.putExtras(b);
    //     intent.putExtras(b1);

    startActivity(intent);/*from w  w  w  .j  av  a 2s.c  om*/

}

From source file:gov.wa.wsdot.android.wsdot.ui.NewsFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Bundle b = new Bundle();
    Intent intent = new Intent(getActivity(), NewsDetailsActivity.class);
    b.putString("title", newsItems.get(position).getTitle());
    b.putString("description", newsItems.get(position).getDescription());
    b.putString("link", newsItems.get(position).getLink());
    b.putString("publishDate", newsItems.get(position).getPubDate());
    intent.putExtras(b);

    startActivity(intent);/*from   w ww.  j a  va2  s  .  c om*/
}

From source file:li.barter.fragments.LoginFragment.java

@Override
public void onSuccess(final int requestId, final IBlRequestContract request, final ResponseInfo response) {
    if (requestId == RequestId.CREATE_USER) {

        final Bundle userInfo = response.responseBundle;

        Utils.updateUserInfoFromBundle(userInfo, true);
        BarterLiApplication.startChatService();

        final String locationId = userInfo.getString(HttpConstants.LOCATION);
        Intent returnIntent = getDefaultOnwardIntent();
        if (TextUtils.isEmpty(locationId)) {
            returnIntent = new Intent(getActivity(), SelectPreferredLocationActivity.class);
            returnIntent.putExtra(Keys.ONWARD_INTENT, getDefaultOnwardIntent());
        }//  ww  w  . j a v a 2 s .  com

        final Intent data = new Intent();
        data.putExtra(Keys.ONWARD_INTENT, returnIntent);
        getActivity().setResult(Activity.RESULT_OK, returnIntent);
        getActivity().finish();

    } else if (requestId == RequestId.REQUEST_RESET_TOKEN) {

        final Intent resetPasswordIntent = new Intent(getActivity(), PasswordResetActivity.class);
        resetPasswordIntent.putExtra(Keys.EMAIL, mEmailForPasswordChange);

        if (getArguments() != null) {
            resetPasswordIntent.putExtras(getArguments());
        }

        startActivityForResult(resetPasswordIntent, AppConstants.RequestCodes.RESET_PASSWORD);
    }

}

From source file:com.eusecom.attendance.AbsenceActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_absence);
    //showProgressDialog();

    mActionBarToolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(mActionBarToolbar);
    getSupportActionBar().setTitle(getString(R.string.absence));

    // Create the adapter that will return a fragment for each section
    mPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
        private final Fragment[] mFragments = new Fragment[] { new MyAbsenceFragment(),
                new MyAttendanceFragment(), new AbsTypesFragment() };
        private final String[] mFragmentNames = new String[] { "Absences", "Attendances", "AbsTypes" };

        @Override//ww  w .j  a  v a 2 s  . c  om
        public Fragment getItem(int position) {
            return mFragments[position];
        }

        @Override
        public int getCount() {
            return mFragments.length;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            return mFragmentNames[position];
        }
    };
    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mPagerAdapter);

    mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        public void onPageScrollStateChanged(int state) {
        }

        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        public void onPageSelected(int position) {
            // Check if this is the page you want.
            if (position == 0) {
                FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_new_post);
                fab.setVisibility(View.VISIBLE);
                whatispage = 0;
            }
            if (position == 1) {
                FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_new_post);
                fab.setVisibility(View.GONE);
                whatispage = 1;
            }
            if (position == 2) {
                FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_new_post);
                fab.setVisibility(View.GONE);
                whatispage = 2;
            }
        }
    });

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);

    // Button launches NewPostActivity
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_new_post);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Intent i = null;
            if (whatispage == 0) {
                i = new Intent(AbsenceActivity.this, NewAbsenceActivity.class);
            }
            if (whatispage == 2) {
                i = new Intent(AbsenceActivity.this, NewPostActivity.class);
            }
            Bundle extras = new Bundle();
            extras.putString("editx", "0");
            extras.putString("keyx", "0");

            i.putExtras(extras);
            startActivity(i);

        }
    });
    //hideProgressDialog();
}

From source file:com.adamas.client.android.ui.ConnectorsFragment.java

private void editAdamasConnector(int position) {
    Connector ac = this._vpnList.get(position);
    Intent intent = new Intent(getActivity(), EditConnectorActivity.class);
    Bundle mBundle = new Bundle();
    mBundle.putSerializable(EditConnectorActivity.ADAMAS_CONNECTOR, ac);
    intent.putExtras(mBundle);
    startActivityForResult(intent, MainActivity.MANUALLY_EDIT_CONNECTOR_REQUEST_CODE);
}

From source file:com.facebook.internal.LikeActionController.java

private static void broadcastAction(LikeActionController controller, String action, Bundle data) {
    Intent broadcastIntent = new Intent(action);
    if (controller != null) {
        if (data == null) {
            data = new Bundle();
        }//from  w  w  w .  j  a va  2s.c  om

        data.putString(ACTION_OBJECT_ID_KEY, controller.getObjectId());
    }

    if (data != null) {
        broadcastIntent.putExtras(data);
    }
    LocalBroadcastManager.getInstance(applicationContext).sendBroadcast(broadcastIntent);
}