Android new Activity Extending ActionBar class instead of Activity class - android

I have eclipse(Kepler) and latest sdk installed. Whenever i create a new activity inside android project, activity is extending ActionBarActivity. But i need new activity to extend Activity.class. How to do this?

There is no other way to extend an class with Activity.Class automatically other than changing declaration of the class manually.

Related

Change the default settings to create new projects

I have two questions here, both related.
When I create a new project with a blank activity in Android studio the project always creates an app with an ActionBarActivity.
public class MainActivity extends ActionBarActivity {
1.How can I change my project defaults to remove this default and just create a project as:
public class MainActivity
OR
to update it so its is not creating an app with deprecated code. Please see image.
Unfortunately there is no way to reconfigure the content of main activity created by default. Possibly the Google engineers will fix it some time in the future.
What you can do here to save some time is move the caret to the ActionBarActivity while being in the MainActivity.java file and hit Alt+Enter. The quick fix "Replace with AppCompatActiivty" will pop up and all you'll need to do is hit Enter to apply it. It's easier than replacing ActionBarActivity with AppCompactActivity by typing.
For 1. change to public class MainActivity extends Activity
For 2. change to public class MainActivity extends AppCompactActivity
EDIT: Creating project without activity.

Create New Activity adds an activity which extends Activity class instead of ActionBarActivity class in Eclipse

I am a newbie to android and I was following the tutorial on android.developer.com,Where a new Activity creation adds an activity which extends ActionBarActivity by default,but When i
create a new Activity it extends Activity class by default
I have also tried to set the Min API to 4.1 Jelly Bean and target to 4.4 as ActionBarActivity is available in later API but it didn't work,I have downloaded the Adt bundle from the site
When you create new project in eclipse, you should select min required SDK below 14 to extend from ActionBarActivity.
Check this: android adt bundle automatically extending ActionBarActivity and adding fragments and more stuff?

How to use the ListActivity in the new Android Project Template?

Since the new Android SDK Update I have a ActionBarActivity for my MainActivity.
Before that is was a normal activity and I just replaced it with the: ListActivity
How can I add use the ListActivity in my new MainActivity which is a ActionBarActivity?
You can get rid of extends ActionbarActivity and extends ListActivity. You could also use ListFragment.
You can extend ActionBarActivtiy and use ListFragment from the support library
http://developer.android.com/reference/android/support/v4/app/ListFragment.html

CalendarDatePickerDialog on Activity without support package

I'm using CalendarDatePickerDialog from BetterPickers in my project,
if i use a FragmentActivity, then i can use the getSupportFragmentManager().
The problem is that i'm trying to add CWAC-Camera as well,
but for that i need to use
getFragmentManager() in a regular Activity which breaks the BettePickers.
any ideas?
Try to extends FragmentActivity and implements CalendarDatePickerDialog.OnDateSetListener
Change your Activity to FragmentActivity.
Use the newInstance(YouActivity.this)
Enjoy!

Android app with setVolume.... extending TabActivity

hi i've an app where i want to implement setVolumeControlStream
but i can't because my class extends TabActivity not Activity. what shall i do ??
setVolumeControlStream() is available on TabActivity, because TabActivity inherits from Activity.

Categories

Resources