I'm having problem with ActionBar Sherlock (latest version), after successful compilation I don't see ActionBar in app. Just black screen and default TextView...
Before I've a problem with install libraries, but after added Support Library to ActionBarSherlock I can built it.
import com.actionbarsherlock.app.SherlockActivity;
public class MainActivity extends SherlockActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Manifest:
android:theme="#style/Theme.Sherlock"
Make sure your android:targetSdkVersion is set to 11 or higher in your manifest.
Related
I've seriously tried everything.
I've tried both setLogo() and setIcon().
I've tried adding android:logo="" in manifest.
I've made sure to try both supportActionBar and regular ActionBar. (I'm running sdk 21 with a min sdk of 15.)
The funny thing is if I try to use the regular ActionBar I get null pointers but when I use the support ActionBar it at least works.
Is there anything else I can try...? Here's where I try and change it.
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar ab = getSupportActionBar();
ab.setLogo(R.drawable.logo);
If your min sdk is 15, i'm not sure why you're using the support package at all.
You class should instead extend Activity, and use getActionBar().
I have an fullscreen apllication. I'm using requestWindowFeature(Window.FEATURE_NO_TITLE) to remove the title. This works very well for my 4.1.2 Smartphone and the 4.4.2 Emulator.
In the 2.2 Emulator, on my 2.2 Smartphone and on my 2.3.6 tablet the title is still being displayed. I tried very much things like changing styles in the Manifest or editing those styles in the styles.xml, nothing works.
Here's my onCreate():
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
GameData.display = new Display(this);
setContentView(GameData.display);
CoreData.mainActivity = this;
NetworkData.init();
}
If you want to remove the title, just add this style into your manifest file.
android:theme="#style/Theme.Black.NoTitleBar"
then the problem arises, notifying that you must use a derivative of an appcompat library. this is because you are using the support library v7, & on creating your project, an activity creates which doesn't extends as an Activity class, but ActionBarActivity class.
so, if you really want to use the support library, create the theme that you created under values, values-v11, values-v14 folders & apply your theme on your manifest.
else, change your ActionBarActivity class into Activity class & apply Theme.Black.NoTitleBar theme to your manifest.
hope that it helps.
I am new to android i made a project but every I create a project class it extends actionbaractivity always created, instead of extends activity before it was extends activity every time I created a class, maybe i press something But i dont really know what happned.
This is the result and actionbarActivity is error
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
If you set up your project to target API < 11 there will be checkboxes for certain support features. ActionBar, GridLayout, Fragments, and NavDrawer. If you check ActionBar the activity that is generated will extend ActionBarActivity (which is the support version of a fragment activity) It may be confusing at first but it's all in the name of supporting older versions of Android with the latest features.
http://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html
If you set your minimum required SDK below 11 it will create the application like this because in API level below 11 there is no ActionBar. The default value is 8. You should set it 14 and then you can change it in your AndroidManifest.xml file.
looks like i have a smaller Problem but cant find why.
In my SherlockFragmentActivity onCreate i do the following:
#Override
public void onCreate(final Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_PROGRESS);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
The AndroidManifest.xml
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
In an Fragment which loads some Data i do a simple:
getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true);
All working great on ICS, but same code running on my 3.1 Tablet never show an ProgressBar when requested. Anyone can give me an hint why this happen ?
I also have the problem in the Emulator running 2.2, no Progress ever shown. I looked again into FeatureToggles from the Sherlock Samples, same code, different result :/
PS: Using 4.01 of ActionBar Sherlock
Make sure you are using the com.actionbarsherlock.view.Window import instead of android.view.Window.
If you miss this import change the progress method calls will only ever work on ICS and newer devices.
public class ActivityGoogleMaps extends MapActivity {// map view shows as an error
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
I try to import this:
import com.google.android.maps.MapActivity;
but when i type com. - google doesnt appear..
1- Go to Project Properties
2- From android tab, select Google API for your target platform
(for 2.2, select Google APIs-Platform 2.2 and things like that)
I think this can solve the problem
you will have to add map.jar to libs. though it is automatically added when we extends MapActivity.