Skip to content Skip to sidebar Skip to footer

Open An Activity By Click On A Imageview

I'm trying to make an ImageView open another activity: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) {

Solution 1:

move return true as last statement of onCreateOptionsMenu

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.gtacheats, menu);


    ImageView Image1 = (ImageView) findViewById(R.id.Image1);
    Image1.setClickable(true);
    Image1.setOnClickListener(new View.OnClickListener() {

        public void onClick(View V) {

        Intent intent = new Intent(V.getContext(), Activity2.class);
        startActivityForResult(intent, 0);
        }
  });
  return true;
}

Post a Comment for "Open An Activity By Click On A Imageview"