Example usage for android.content Intent setClass

List of usage examples for android.content Intent setClass

Introduction

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

Prototype

public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls) 

Source Link

Document

Convenience for calling #setComponent(ComponentName) with the name returned by a Class object.

Usage

From source file:com.hacktx.android.activities.MainActivity.java

private void setupAppShortcuts() {
    // Setup app shortcuts
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1
            && mConfigManager.getValue(ConfigParam.CHECK_IN)) {
        ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);

        Intent checkInIntent = new Intent(Intent.ACTION_VIEW);
        checkInIntent.setPackage("com.hacktx.android");
        checkInIntent.setClass(this, CheckInActivity.class);
        checkInIntent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY
                | Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
        checkInIntent.putExtra("fromShortcut", true);

        ShortcutInfo shortcut = new ShortcutInfo.Builder(this, "check-in")
                .setShortLabel(getString(R.string.app_shortcut_check_in))
                .setLongLabel(getString(R.string.app_shortcut_check_in))
                .setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher)).setIntent(checkInIntent).build();

        shortcutManager.addDynamicShortcuts(Arrays.asList(shortcut));
    }//  w w  w  .jav a 2  s .  c  om
}

From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.Motion.java

@Override
public void onListItemClick(ListView list, View v, int position, long id) {

    Toast.makeText(this, getListView().getItemAtPosition(position).toString(), Toast.LENGTH_SHORT).show();
    MotionItem[] p = Motion.motionTitle;
    D_Motion m = null;/*ww w  .j  a  v a  2s.  c  o m*/
    try {
        if (position >= p.length)
            return;
        m = p[position].motion;
    } catch (Exception e) {
        return;
    }

    Intent intent = new Intent();
    intent.setClass(this, MotionDetail.class);
    Bundle b = new Bundle();
    b.putInt(M_MOTION_ID, position);
    b.putString(M_MOTION_GIDH, m.getGIDH());
    b.putString(M_MOTION_LID, m.getLIDstr());
    b.putString(M_MOTION_TITLE, Util.getString(m.getMotionTitle().title_document.getDocumentString()));
    b.putString(M_MOTION_BODY, Util.getString(m.getMotionText().getDocumentString()));
    intent.putExtras(b);
    startActivity(intent);
}

From source file:com.ape.filemanager.FileExplorerTabActivityOld.java

public void startSearchActivity(String path) {
    Intent intent = new Intent();
    intent.setClass(this, FileManagerSearchActivity.class);
    intent.putExtra(FileManagerSearchActivity.CURRENT_PATH, path);
    intent.putExtra(FileManagerSearchActivity.IS_FROM_FILEMANAGER, true);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);/*  w ww.  ja v  a  2 s  .  c o  m*/
}

From source file:com.dlam.activity.T4Activity.java

private void getData() {
    getListgetInfoList(Integer.toString(curPage), "3", "0", time, new VolleyDataCallback() {
        @Override//from   w  w w.j  a  v a 2  s.  c  o m
        public void onSuccess(A_ListBean bean) {
            curPage++;
            toaPage = Integer.parseInt(bean.getTotalpage());
            datas = bean.getInfolist();

            mAdapter = new A_ListDataAdapter(mContext, datas, R.layout.listitem);
            mListView = mPullListView.getRefreshableView();
            mListView.setAdapter(mAdapter);
            mListView.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    myid = datas.get(position).getId().toString();
                    Intent intent = new Intent();
                    intent.putExtra("myid", myid);
                    intent.setClass(mContext, A_ServiceDetailActivity.class);
                    T4Activity.this.startActivity(intent);
                }
            });
        }
    });
    mPullListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        @Override
        public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
            //mIsStart = true;
            getUpdateData();
        }

        @Override
        public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            //mIsStart = false;
            getMoreData();
        }
    });
    setLastUpdateTime();
}

From source file:com.easemob.chatuidemo.activity.AddContactActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    User user = list.get(position);/*from w w  w.  ja va  2 s .c  o m*/
    Intent it = new Intent();
    Bundle bundle = new Bundle();
    bundle.putSerializable("user", user);
    it.putExtras(bundle);
    it.setClass(this, Activity_boshu_AddFriend.class);
    startActivity(it);
}

From source file:com.miz.mizuu.AddNetworkFilesourceDialog.java

@SuppressLint("UseSparseArrays")
public void search(View v) {
    final ArrayList<FileSource> sources = new ArrayList<FileSource>();

    DbAdapterSources dbHelper = MizuuApplication.getSourcesAdapter();

    // Fetch all movie sources and add them to the array
    Cursor cursor = dbHelper.fetchAllSources();
    while (cursor.moveToNext()) {
        if (cursor.getInt(cursor.getColumnIndex(DbAdapterSources.KEY_FILESOURCE_TYPE)) == FileSource.SMB)
            sources.add(new FileSource(cursor.getLong(cursor.getColumnIndex(DbAdapterSources.KEY_ROWID)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterSources.KEY_FILEPATH)),
                    cursor.getInt(cursor.getColumnIndex(DbAdapterSources.KEY_FILESOURCE_TYPE)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterSources.KEY_USER)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterSources.KEY_PASSWORD)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterSources.KEY_DOMAIN)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterSources.KEY_TYPE))));
    }/* w ww  . j  av  a2 s.  co  m*/

    cursor.close();

    TreeSet<String> uniqueSources = new TreeSet<String>();

    int count = sources.size();
    for (int i = 0; i < count; i++) {
        String temp = sources.get(i).getFilepath().replace("smb://", "");
        temp = temp.substring(0, temp.indexOf("/"));
        uniqueSources.add(temp);
    }

    final CharSequence[] items = new CharSequence[uniqueSources.size() + 1];

    count = 0;
    Iterator<String> it = uniqueSources.iterator();
    while (it.hasNext()) {
        items[count] = it.next();
        count++;
    }

    items[items.length - 1] = getString(R.string.scanForSources);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(R.string.browseSources));
    builder.setItems(items, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            if (which == (items.length - 1)) {
                Intent intent = new Intent();
                intent.setClass(getApplicationContext(), SearchForNetworkShares.class);
                startActivity(intent);
            } else {
                showUserDialog(items, which);
            }
        }
    });
    builder.show();
}

From source file:com.miz.mizuu.ShowDetails.java

private void identifyShow() {
    ArrayList<String> files = new ArrayList<String>();

    DbAdapterTvShowEpisode db = MizuuApplication.getTvEpisodeDbAdapter();

    Cursor cursor = db.getAllEpisodes(thisShow.getId(), DbAdapterTvShowEpisode.OLDEST_FIRST);
    while (cursor.moveToNext())
        files.add(cursor.getString(cursor.getColumnIndex(DbAdapterTvShowEpisode.KEY_FILEPATH)));

    cursor.close();/* w ww  .ja  v a2s . c  o m*/

    Intent i = new Intent();
    i.setClass(this, IdentifyTvShow.class);
    i.putExtra("rowId", "0");
    i.putExtra("files", files.toArray(new String[files.size()]));
    i.putExtra("showName", thisShow.getTitle());
    i.putExtra("oldShowId", thisShow.getId());
    i.putExtra("isShow", true);
    startActivity(i);
}

From source file:com.phicdy.mycuration.ui.TopActivity.java

@Override
public void onCurationListClicked(int position) {
    Intent intent = new Intent();
    intent.setClass(getApplicationContext(), ArticlesListActivity.class);
    intent.putExtra(CURATION_ID, curationFragment.getCurationIdAtPosition(position));
    startActivity(intent);/*  w  w  w .j  a  v  a  2  s  .c  o m*/
}

From source file:com.androchill.call411.MainActivity.java

/**
 * When the user clicks a thumbnail, bundle up information about it and launch the
 * details activity./*from  w  ww.j a va2 s .  c o m*/
 */
public void showPhoto(View view, Phone phone) {
    Intent intent = new Intent();
    intent.setClass(this, DetailActivity.class);

    intent.putExtra("phone", phone);
    lastViewed = view;
    startPhoneActivity(view, intent);
}

From source file:com.example.android.wizardpager.wizard.ui.CustomerAddressFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = new Intent();
    intent.setClass(getActivity(), Address.class);
    getActivity().startActivity(intent);

    Bundle args = getArguments();//from ww w. j a v a2s . c  o m
    mKey = args.getString(ARG_KEY);
    mPage = (CustomerAddressPage) mCallbacks.onGetPage(mKey);

}