I need some guidance regarding the working of Action bar. Actually clicking on a Action bar MenuItem
. Current activity must be moved to another activity. But it's doing nothing. Not even any error. I used following code:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mnew1, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
switch (item.getItemId()) {
case R.id.home:
try {
openSearch();
} catch (IOException e) {
e.printStackTrace();
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void openSearch() throws IOException{
val=address(location.getLatitude(), location.getLongitude());
Intent intnt=new Intent(getApplicationContext(),SendSms.class);
intnt.putExtra("loct", val);
startActivity(intnt);
}