Intent的简单使用
第一种:
Intent intent = new Intent(Forward.this, ForwardResult.class); startActivity(intent);
第二种:
Intent intent = new Intent(); intent.setClass(Forward.this, ForwardResult.class); startActivity(intent);
第三种:
Intent intent = new Intent(); ComponentName name = new ComponentName(getPackageName(),ForwardResult.class.getName()); intent.setComponent(name); startActvity(intent);
存值:
Intent intent = new Intent(); //intent.putExtra(name,value); intent.putExtra("username","huanpen"); intent.setClass(Forward.this, ForwardResult.class); startActivity(intent);
取值:
Intent intent = getIntent();
intent.getStringExtra(name);
intent.getStringExtra("username");