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.gikoo5.hyphenate.ui.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.em_fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override/*w w  w .j a  va  2 s  . co  m*/
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = EMHelper.getInstance().getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:cn.ucai.foraging.activity.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(cn.ucai.foraging.R.layout.fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(cn.ucai.foraging.R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(cn.ucai.foraging.R.id.swipe_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    progressBar = findViewById(cn.ucai.foraging.R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override/* ww  w. ja va 2s . c om*/
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:cmu.cconfs.instantMessage.activities.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override// ww w .j  av a  2 s  .c  om
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = ((IMHXSDKHelper) HXSDKHelper.getInstance()).getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:cn.ucai.SuperWechat.activity.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override//from w  w w  .j a va2 s.c  o m
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:cn.xcom.helper.chat.ui.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.em_fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override/*from   w w w  .  j a va 2s  .com*/
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = DemoHelper.getInstance().getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:cn.gen.superwechat.activity.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(cn.gen.superwechat.R.layout.fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(cn.gen.superwechat.R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(cn.gen.superwechat.R.id.swipe_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    progressBar = findViewById(cn.gen.superwechat.R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override//from w  w  w . j av a  2  s.com
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:cn.hbm.superwechat.activity.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
    mListView = (ListView) findViewById(R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override//from   ww w .j a  v  a 2 s. c o  m
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:com.abroad.ruianju.im.ui.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.em_fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    ListView mListView = (ListView) findViewById(R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    if (android.os.Build.VERSION.SDK_INT >= 14) {
        swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
                android.R.color.holo_green_light, android.R.color.holo_orange_light,
                android.R.color.holo_red_light);
    }/* w  w w.j  av  a 2s  .  com*/
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = DemoHelper.getInstance().getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:com.avcall.app.ui.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.em_fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    ListView mListView = (ListView) findViewById(R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    if (android.os.Build.VERSION.SDK_INT >= 14) {
        swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
                android.R.color.holo_green_light, android.R.color.holo_orange_light,
                android.R.color.holo_red_light);
    }/* ww  w .  j  ava 2s  . co  m*/
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = AvcallHelper.getInstance().getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}

From source file:com.lykj.weixun.ui.chat.ui.RobotsActivity.java

@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.em_fragment_robots);
    inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
    ListView mListView = (ListView) findViewById(R.id.list);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    if (android.os.Build.VERSION.SDK_INT >= 14) {
        swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
                android.R.color.holo_green_light, android.R.color.holo_orange_light,
                android.R.color.holo_red_light);
    }/*from w w  w.  j  a v  a 2  s  . com*/
    progressBar = findViewById(R.id.progress_bar);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            getRobotNamesFromServer();
        }
    });
    Map<String, RobotUser> robotMap = DemoHelper.getInstance().getRobotList();
    if (robotMap != null) {
        robotList.addAll(robotMap.values());
    } else {
        progressBar.setVisibility(View.VISIBLE);
        getRobotNamesFromServer();
    }
    adapter = new RobotAdapter(this, 1, robotList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            RobotUser user = (RobotUser) parent.getItemAtPosition(position);
            Intent intent = new Intent();
            intent.setClass(RobotsActivity.this, ChatActivity.class);
            intent.putExtra("userId", user.getUsername());
            startActivity(intent);
        }
    });
    mListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
}