Added AOSP srandard ActionBar and began writing my customizations.

master
Chris Baughman 2014-01-29 23:03:02 -05:00
parent 07275a8c11
commit 1f115d2dd1
2 changed files with 38 additions and 3 deletions

View File

@ -9,4 +9,3 @@
# Project target.
target=android-10
android.library.reference.1=/storage/emulated/0/Download/JakeWharton-ActionBarSherlock-4.4.0-0-g4a79d53/JakeWharton-ActionBarSherlock-5a15d92/actionbarsherlock

View File

@ -19,6 +19,13 @@ public class MainActivity extends Activity
ArrayAdapter<String> adapter;
List<String> list= null;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflator = getMenuInflater();
inflator.inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu);
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
@ -90,6 +97,35 @@ public class MainActivity extends Activity
, "Opening http://google.com/#q=" + URLEncoder.encode(list.get(pos)), Toast.LENGTH_LONG).show();
}
});
}
/**
* On selecting action bar icons
* */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Take appropriate action for each action item click
switch (item.getItemId()) {
case R.id.action_search:
// search action
return true;
case R.id.action_location_found:
// location found
LocationFound();
return true;
case R.id.action_refresh:
// refresh
return true;
default:
return super.onOptionsItemSelected(item);
}
}
/**
* Launching new activity
* */
private void LocationFound() {
Intent i = new Intent(MainActivity.this, LocationFound.class);
startActivity(i);
}
}