Showing posts from April, 2013

Problems&Solutions on Android Development for Beginner Version 2

Clicking app icon doesn't trigger onOptionsItemSelected()
For packages targetting API level 14 onwards, you need to enable the home button by calling setHomeButtonEnabled()
In your onCreate, add the following:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {     getActionBar().setHomeButtonEnabled(true); }
Android Tutorial: Using the ViewPager

The project was not built since its build path is incompleteRight click on project -> Properties -> Java Build Path (From Left List) -> Libraries (Tab) -> Add Library (Button on right) -> JRE System Library -> Next -> Workspace default JRE -> Finish

Example Code to let app icon send user to home Activity public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case             // app icon in action bar clicked; go home             Intent intent = new Intent(this, OverviewActivity.class);             intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);             start…

Problems&Solutions on Android Development for Beginner

Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.

Android SDK isn't x64, but works ok with x64 jvm (and x64 eclipse IDE). As helios said, you must set project compatibility to Java 5.0 or Java 6.0. To do that, 2 options: right-click on your project and select "Android Tools -> Fix Project Properties" (if this din't work, try second option)right-click on your project and select "Properties -> Java Compiler", check "Enable project specific settings" and select 1.5 or 1.6 from "Compiler compliance settings" select box.If you has setContentView Error try to solve it too.(the solution is shown below)

setContentView(R.layout.Main); Main cannot be resolved or is not a field

Delete from imports android.R.layout and use layout from your package. In some case delete import android.R.

Also try to update ide,android SDK etc.