First, let’s clarify our thinking:
The activity we are in is called MainActivit
To jump to the activity page named List
In this article, the id of the control we want to write is the ID of the control we need to click in the MainActivity. In this article, MINE is a TextView or Button, depending on your situation
The emphasis is on intents
Post code:
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DensityUtils.setDensity(getApplication(),this); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setContentView(R.layout.activity_main); TextView tv5_11=(TextView) this.findViewById(R.id.tv5_11); tv5_11.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent1 = new Intent(); intent1.setClass(MainActivity.this,List.class); startActivity(intent1); }}); }}Copy the code
Copy the code