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:de.evilbrain.sendtosftp.Main.java

public void serverEdit() {

    // Get selected server
    String server = serverListGetActive();
    if (server != null) {

        // Set Intent with json-string
        Intent intent = new Intent();
        intent.setClass(Main.this, addServer.class);
        conf.putServerToIntent(intent, server);
        conf.putSettingsToIntent(intent);

        // Start activity
        startActivityForResult(intent, 1);

    }//from  w ww.  j a  va 2 s .c om
}

From source file:com.ezevents.android.app.MainActivity.java

private void create_event() {
    Intent intent = getIntent();
    intent.setClass(this, EventFirstStepActivity.class);

    //attemptLogin();
    startActivity(intent);//from   w w w .j ava  2s  .  c  o m

}

From source file:cc.softwarefactory.lokki.android.androidServices.LocationService.java

private void triggerBuzzing(Place place) {
    Place.Buzz buzz = place.getBuzzObject();
    if (buzz.isActivated() || buzz.getBuzzCount() <= 0)
        return;/*from  w  w  w .ja va  2 s .c om*/

    buzz.setActivated(true);

    Intent i = new Intent();
    i.setClass(this, BuzzActivity.class);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(i);
    showArrivalNotification();
    Log.d(TAG, "Starting vibration...");
    new Thread(new VibrationThread(place)).start();
}

From source file:com.example.tabstemplate.MainActivity.java

/**
 * get current view/*from w w w . j  a v  a  2  s . co m*/
 * 
 * @param index
 * @return View
 */
private View getView(int index) {
    Log.d(TAG, "getView>>>index = " + index);
    View view = null;
    Intent intent = new Intent();
    switch (index) {
    case TAB0_INDEX:
        intent.setClass(this, Activity0.class);
        break;
    case TAB1_INDEX:
        intent.setClass(this, Activity1.class);
        break;
    case TAB2_INDEX:
        intent.setClass(this, Activity2.class);
        break;
    case TAB3_INDEX:
        intent.setClass(this, Activity3.class);
        break;
    default:
        Log.d(TAG, "default");
        return null;
    }
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    view = mActivityManager.startActivity(getStringId(index), intent).getDecorView();
    Log.d(TAG, "getView<<<");
    return view;
}

From source file:com.android.managedprovisioning.DeviceOwnerProvisioningService.java

private void sendError() {
    if (DEBUG) {/*from  w  w  w .j  a va 2  s  .c  o  m*/
        ProvisionLogger.logd("Reporting Error: " + getResources().getString(mLastErrorMessage));
    }
    Intent intent = new Intent(ACTION_PROVISIONING_ERROR);
    intent.setClass(this, DeviceOwnerProvisioningActivity.ServiceMessageReceiver.class);
    intent.putExtra(EXTRA_USER_VISIBLE_ERROR_ID_KEY, mLastErrorMessage);
    intent.putExtra(EXTRA_FACTORY_RESET_REQUIRED, mFactoryResetRequired);
    LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
}

From source file:com.jgkj.bxxc.fragment.IndexFragment2.java

@Override
public void onClick(View v) {
    fragmentManager = getFragmentManager();
    transaction = fragmentManager.beginTransaction();
    license_Text_Fragment1 = new License_Text_Fragment();
    license_Text_Fragment2 = new License_Text_Fragment();
    switch (v.getId()) {
    case R.id.first_Text_btn:
        if (mCurrentFragment != license_Text_Fragment1) {
            first_btn.setBackgroundResource(R.drawable.btn_background);
            first_btn.setTextColor(getResources().getColor(R.color.red));
            fourth_btn.setBackgroundResource(R.color.white);
            fourth_btn.setTextColor(getResources().getColor(R.color.black));
            Bundle bundle1 = new Bundle();
            bundle1.putInt("index", 1);
            license_Text_Fragment1.setArguments(bundle1);
            switchFragment(mCurrentFragment, license_Text_Fragment1);
            mCurrentFragment = license_Text_Fragment1;
        } else {/*  ww w  . ja v  a 2s . c o  m*/
            Toast.makeText(getActivity(), "??", Toast.LENGTH_SHORT)
                    .show();
        }
        break;
    case R.id.fourth_Text_btn:
        if (mCurrentFragment != license_Text_Fragment2) {
            fourth_btn.setBackgroundResource(R.drawable.btn_background);
            fourth_btn.setTextColor(getResources().getColor(R.color.red));
            first_btn.setBackgroundResource(R.color.white);
            first_btn.setTextColor(getResources().getColor(R.color.black));
            Bundle bundle4 = new Bundle();
            bundle4.putInt("index", 4);
            license_Text_Fragment2.setArguments(bundle4);
            switchFragment(mCurrentFragment, license_Text_Fragment2);
            mCurrentFragment = license_Text_Fragment2;
        } else {
            Toast.makeText(getActivity(), "??", Toast.LENGTH_SHORT)
                    .show();
        }
        break;
    case R.id.aboutbaixinLayout:
        Intent img = new Intent();
        img.setClass(getActivity(), GuideActivity.class);
        startActivity(img);
        break;
    case R.id.jiesongLayout:
        Intent intent = new Intent(getActivity(), CarSendActivity.class);
        startActivity(intent);
        break;
    case R.id.chengnuoLayout:
        text_title.setText("");
        Intent intent3 = new Intent();
        intent3.setClass(getActivity(), HomeActivity.class);
        intent3.putExtra("FromActivity", "IndexFragment");
        startActivity(intent3);
        getActivity().finish();
        mCurrentFragment = coach;
        break;
    case R.id.liuchengLayout:
        Intent space_intent = new Intent();
        space_intent.setClass(getActivity(), PlaceChooseActivity.class);
        startActivity(space_intent);
        break;
    case R.id.headlines:
        if (headlines.getTag().toString().equals("nourl")) {
            Toast.makeText(getActivity(), ",???!", Toast.LENGTH_SHORT).show();
        } else {
            Intent headlinesIntent = new Intent();
            headlinesIntent.setClass(getActivity(), WebViewActivity.class);
            headlinesIntent.putExtra("url", headlines.getTag().toString());
            headlinesIntent.putExtra("title", "?");
            startActivity(headlinesIntent);
        }
        break;
    case R.id.bxhead:
        Intent bxheadIntent = new Intent();
        bxheadIntent.setClass(getActivity(), HeadlinesActivity.class);
        startActivity(bxheadIntent);
        break;
    }
}

From source file:com.android.together.BaseActivity.java

/** BundleClass **/
protected void startActivity(Class<?> cls, Bundle bundle) {
    Intent intent = new Intent();
    intent.setClass(this, cls);
    if (bundle != null) {
        intent.putExtras(bundle);/*  ww  w .  j a  va  2s  .  co  m*/
    }
    startActivity(intent);
}

From source file:com.imalu.alyou.activity.ConsortialistFragment.java

private void setListviewListener() {
    // TODO Auto-generated method stub
    popularlist.setOnItemClickListener(new OnItemClickListener() {

        @Override//  w w  w. ja  va2s.  co m
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub
            Toast.makeText(getActivity(), "" + popularsociaties.get(arg2).getType(), Toast.LENGTH_SHORT).show();
            Intent intent = new Intent();
            intent.setClass(getActivity(), AssocationDataActivity.class);
            intent.putExtra("Id", popularsociaties.get(arg2).getId());
            intent.putExtra("SocietyName", popularsociaties.get(arg2).getSocietyname());
            intent.putExtra("SocietySummary", popularsociaties.get(arg2).getSocietysummary());
            intent.putExtra("SocietyKey", popularsociaties.get(arg2).getKey());
            intent.putExtra("Key", key);
            intent.putExtra("JiFen", popularsociaties.get(arg2).getJifen());
            startActivity(intent);

        }
    });

    search_bt.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent();
            intent.setClass(getActivity(), AssociationSearchActivity.class);
            startActivity(intent);

        }
    });

}

From source file:org.ewicom.pps.unitinfo.TabAddressFragment.java

public void openParent(View view) {
    Intent intent = new Intent();
    intent.setClass(getActivity(), UnitDetails.class);
    intent.putExtra(PPSAddressBookPreferences.INTENT_EXTRA_UNIT_ID, unit.getParentId());
    startActivity(intent);//  w w  w  . j  a v a  2  s .c  om
    getActivity().finish();
}

From source file:com.appdynamics.demo.gasp.activity.LocationsActivity.java

/**
 * Launch child activity to display details for selected Gasp! location
 * @param placeDetails Details for Gasp! location
 *//*w w w . j a  va  2 s  . c  om*/
private void launchPlacesDetailActivity(PlaceDetails placeDetails) {
    try {
        Intent intent = new Intent();
        intent.setClass(LocationsActivity.this, PlacesDetailActivity.class);
        intent.putExtra(PlacesDetailActivity.PLACES_DETAIL_SERIALIZED, placeDetails.getResult());
        intent.putExtra(PlacesDetailActivity.PLACES_DETAIL_REFERENCE,
                mReferencesMap.get(placeDetails.getResult().getId()));
        startActivityForResult(intent, 0);
    } catch (Exception e) {
        e.printStackTrace();
    }
}