I am attempting to create an android app, I am a relative novice. I am tryin to use multiple image buttons, however, I cannot get it to work, here is the code that I am using.
Public class MapScreen extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.belfast_map);
ImageButton ib1,ib2,ib3,ib4,ib5;
ib1= (ImageButton) findViewById(R.id.go_to_lagan_screen);
ib2= (ImageButton) findViewById(R.id.go_to_city);
ib3= (ImageButton) findViewById(R.id.go_to_university);
ib4= (ImageButton) findViewById(R.id.go_to_icon_screen);
ib5= (ImageButton) findViewById(R.id.map_to_home_screen);
ib1.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent (v.getContext(), LaganArea.class);
startActivityForResult(intent,0);
//To change body of implemented methods use File | Settings | File Templates.
}
} );
ib2.setOnClickListener((new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent1= new Intent (v.getContext(), CityCentre.class);
startActivityForResult(intent1,0);
//To change body of implemented methods use File | Settings | File Templates.
}
}));
ib3.setOnClickListener((new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent2= new Intent (v.getContext(), UniversityArea.class);
startActivityForResult(intent2,0);
//To change body of implemented methods use File | Settings | File Templates.
}
}));
ib4.setOnClickListener((new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent3= new Intent (v.getContext(), TheIcons.class);
startActivityForResult(intent3,0);
//To change body of implemented methods use File | Settings | File Templates.
}
}));
ib5.setOnClickListener((new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent4= new Intent (v.getContext(), MyActivity.class);
startActivityForResult(intent4,0);
//To change body of implemented methods use File | Settings | File Templates.
}
}));
}
}
I don't know if I've missed something silly, or have I set about it the completely wrong way. But an extra pair of eyes over it would be greatly appreciated.