baharsan
baharsan

Reputation: 181

Confuse using ADT 20

Can I use API 10 in ADT 20 ? When I created a new project, I always get, if I choose targetSdk under API 15. (different from when I used ADT 18 last week)

I want to create a simple "hello world" project that will run on Gingerbread. with ADT 20, eclipse forces me to create a new project using API 15 or higher. How can I solve this problem?

I am using eclipse indigo, Latest SDK and ADT 20.

I am getting errosr in my MainActivity:

getActionBar().setDisplayHomeAsUpEnabled(true);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

case android.R.id.home:

I get an Error in getActionBar()... and case android.R.id.Home

Upvotes: 1

Views: 847

Answers (2)

Oro
Oro

Reputation: 1

Well you don't need to getActionbar for simple hello message . use this function which you are following by android tutorial.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
//  setContentView(R.layout.activity_display_message);
//  getActionBar().setDisplayHomeAsUpEnabled(true);
    Intent intent = getIntent();
    String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    TextView textView = new TextView(this);
    textView.setTextSize(40);
    textView.setText(message);
    setContentView(textView);
}

Upvotes: 0

Ahmad
Ahmad

Reputation: 72613

can I use API 10 in ADT 20 ?

Yes you can.

when i created a new project, i always look errors at the project if i choose build sdk under API 15.

getActionBar().setDisplayHomeAsUpEnabled(true);

That's because you are using an ActionBar. You can't use an ActionBar in API 13<. You won't get Errors if you set the buildtarget to API 15, because then the project will be created as if it would run on ICS. But it it would eventually crash in APIs lower than 13. If you want to create an ActionBar for lower APIs I recommend you using ActionBarSherlock.

Upvotes: 1

Related Questions