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:jp.co.conit.sss.sn.ex2.service.SendMessageIdIntentService.java

/**
 * SamuraiNotification????snUserdata???????
 * //  w  w w.j  ava 2  s.  co m
 * @param snUserdata
 */
private void startActivity4Userdata(String snUserdata) {
    Intent activityIntent = new Intent();
    if (StringUtil.isEmpty(snUserdata) || snUserdata.equals("null")) {
        activityIntent.setClass(getApplicationContext(), MessagesActivity.class);
    } else {
        if (snUserdata.startsWith("http")) {
            activityIntent.setAction(Intent.ACTION_VIEW);
            activityIntent.setData(Uri.parse(snUserdata));
        } else {
            activityIntent.setClass(getApplicationContext(), UserDataActivity.class);
            activityIntent.putExtra("option", snUserdata);
        }
    }
    activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(activityIntent);
}

From source file:com.springsource.greenhouse.events.EventDetailsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.event_details);

    final ListView listView = (ListView) findViewById(R.id.event_details_menu);

    String[] menu_items = getResources().getStringArray(R.array.event_details_options_array);
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, R.layout.menu_list_item, menu_items);
    listView.setAdapter(arrayAdapter);/*from w ww  .ja  v a  2 s .com*/

    listView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent();

            switch (position) {
            case 0:
                intent.setClass(view.getContext(), EventSessionsFilteredActivity.class);
                break;
            case 1:
                intent.setClass(view.getContext(), EventSessionsScheduleActivity.class);
                break;
            case 2:
                intent.setClass(view.getContext(), PostTweetActivity.class);
                break;
            case 3:
                intent.setClass(view.getContext(), EventTweetsActivity.class);
                break;
            default:
                break;
            }

            startActivity(intent);
        }
    });
}

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

@Override
public void onClick(View view) {
    Intent intent = new Intent();
    switch (view.getId()) {
    case R.id.linearlayout1:
        if (index == 1) {
            intent.setClass(getActivity(), SubTestActivity.class);
        } else if (index == 4) {
            intent.setClass(getActivity(), SubFourTestActivity.class);
        }/* w  ww. j  ava  2s .  com*/
        break;
    case R.id.linearlayout4://SubfourErrorTestActivity
        if (index == 1) {
            intent.setClass(getActivity(), SubErrorTestActivity.class);
        } else if (index == 4) {
            intent.setClass(getActivity(), SubfourErrorTestActivity.class);
        }
        break;
    case R.id.linearlayout2:
        if (index == 1) {
            intent.setClass(getActivity(), SubRandTestActivity.class);
        } else if (index == 4) {
            intent.setClass(getActivity(), SubFourRandTestActivity.class);
        }
        break;
    case R.id.linearlayout3:
        if (index == 1) {
            intent.setClass(getActivity(), SubExamTestActivity.class);
        } else if (index == 4) {
            intent.setClass(getActivity(), SubFourExamTestActivity.class);
        }
        break;
    }
    startActivity(intent);
}

From source file:com.gao.im.ui.ECSuperActivity.java

/**
 * /* www  . j a  v  a  2 s .c o  m*/
 * @param clazz
 * @param intent
 */
protected void startCCPActivity(Class<? extends Activity> clazz, Intent intent) {
    intent.setClass(this, clazz);
    startActivity(intent);
}

From source file:com.dfws.idea.ClosePcActivity.java

public void doResult(int action) {
    switch (action) {
    case RIGHT:/* w  w w.j a  v a 2  s.c  om*/
        Toast.makeText(this, "?", Toast.LENGTH_LONG).show();
        break;
    case LEFT:
        //pc
        Intent intent = new Intent();
        intent.setClass(this, ListPcActivity.class);
        startActivity(intent);
        break;
    }
}

From source file:com.app.smsservice.MessagingReceiver.java

private void handleIncomingSms(Context context, Intent intent) {
    // TODO: Handle SMS here
    // As an example, we'll start a wakeful service to handle the SMS
    intent.setAction(MessagingService.ACTION_MY_RECEIVE_SMS);
    intent.setClass(context, MessagingService.class);
    startWakefulService(context, intent);
}

From source file:com.app.smsservice.MessagingReceiver.java

private void handleIncomingMms(Context context, Intent intent) {
    // TODO: Handle MMS here
    // As an example, we'll start a wakeful service to handle the MMS
    intent.setAction(MessagingService.ACTION_MY_RECEIVE_MMS);
    intent.setClass(context, MessagingService.class);
    startWakefulService(context, intent);
}

From source file:com.emartynov.android.app.urlsetter.android.ui.MainActivity.java

@Subscribe
public void onUserInput(UserInputValue event) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_TEXT, event.getUserInput());
    intent.setClass(this, UrlActivity.class);

    startActivity(intent);/* w  ww . j  a  v a  2 s .  c  o m*/
}

From source file:com.example.apple.threaddatabase.ConstantsFragment.java

public void onClick(View view) {
    //        getFragmentManager().beginTransaction().replace(android.R.id.content,new ElementFragment()).commit();
    Intent intent = new Intent();
    intent.putExtra("information", nametemp);
    intent.setClass(getActivity(), Dossier_Activity.class);
    getActivity().startActivity(intent);
}

From source file:com.tundem.alternativefindr.SplashscreenActivity.java

public void finishiing() {
    Intent intent = new Intent();
    intent.setClass(SplashscreenActivity.this, AlternativefindrActivity.class);
    startActivity(intent);//from  w  ww  .  j  av a 2  s .co  m
    SplashscreenActivity.this.finish();
}