Monday, April 15, 2013

[android help] GetSupportActionBar return null


After I started my second Activity, there isn't the ActionBar. When I call GetSupportActivity, it returns null. Why? I have minSdkVersion 10 and targetSdkVersion 15.



package="com.test.myapp"
android:versionCode="1"
android:versionName="1.0" >

android:minSdkVersion="10"
android:targetSdkVersion="15"
/>



android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock.Light"
>
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:windowSoftInputMode="stateHidden"
>






android:name=".ShowMusic2"
android:label="Search Results">









This is the OnCreate of my second activity (ShowMusic2). It is a ListActivity.



public class ShowMusic2 extends SherlockListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

showMusic = getIntent();
pkgName = getPackageName();
html = (String)showMusic.getStringExtra(pkgName + ".html");
new populateListView().execute(songs.toArray(new Song[songs.size()]));
adapter =new SongAdapter(this,R.layout.list_item1, songs.toArray(new Song[songs.size()]));
setListAdapter(adapter);
}


.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...