to Open new activity or page
here is the android code to open new activity from one another activity
here is the android code to open new activity from one another activity
package com.one.click;//Package name //libraries want to import import android.R.string; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; public class MainScreenActivity extends Activity{ //Declare a button Button btnNewProduct; //declare a layout which is want to open when this class called public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_screen);//here is the place to enter layout name // Buttons assign the id of the buton in our layout btnNewProduct = (Button) findViewById(R.id.btnCreateProduct); // here is the place show when click btnNewProduct buton which class want to open btnNewProduct.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { // Launching create new product activity Intent i = new Intent(getApplicationContext(), NewProductActivity.class); startActivity(i); } }); }
No comments:
Post a Comment