Olzhas
Olzhas

Reputation: 235

I am not able to start new activity in Emulator Android 2.3.3 version, but Android 4.1.2 working fine

As I am new to Android development, struggling with a problem. I am testing in Android 4.1.2 its working fine, but when I load it to Android 2.3.3 after that when i click a button, it should start an new activity, but its stops and crashes? what can be problem? the mind_sdk is equals to 9,

  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.starter);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.starter, menu);
        return true;
    }
    public void openS(View view){

        Intent intent = new Intent(this,LoginSU.class );
        startActivity(intent);
    }
    public void openG(View view){
        Intent intent = new Intent(this, LoginGE.class);
        startActivity(intent);
    }
}

When person clicks button, it will fire an action openS or openG, after that it will start an new Activity. Its working in Android 4.1.2 but fails in 2.3.3? hwat can be the cause? Log Cat

11-14 10:11:26.817: I/dalvikvm(910): Could not find method kz.bimash.food.security.LoginSU.getActionBar, referenced from method kz.bimash.food.security.LoginSU.onCreate

Actually I am not using but its requesting an actionbar.

Upvotes: 1

Views: 622

Answers (2)

Tim Kist
Tim Kist

Reputation: 1182

Can you post your AndroidManifest.xml XML and your res/values/style.xml? I wonder if the app theme is for a HOLO theme which is unsupported on 2.3.3 and below and trying to open the app with HOLO. It's a theme which uses the action bar. Or it could be your activity in the manifest is to use a HOLO theme.

Instead make a folder in res/ called values-v11/ and make a new style.xml. You can copy it from the values/. Open the copied file up and check the AppTheme style. Is the parent android:Theme.HOLO or android:Theme.HOLO.Light or something similar? Does it look like this?

<style name="AppTheme" parent="android:Theme.Holo" />

Having separate values/ and values-v11/ folders tells the app what theme to do depending on which version is running. Honeycomb 3.0 (v11) and higher would look at the values-v11 folder for styles and other values, whilst Gingerbread 2.3.4 (v10) and lower would look at the values/ folder.

Now edit the values/style.xml and make the parent android:Theme.Light or android:Theme

Check out http://developer.android.com/guide/topics/ui/themes.html#SelectATheme for more details about how to use multiple themes in the same app.

Upvotes: 1

Chatura Dilan
Chatura Dilan

Reputation: 1572

ActionBar is only support for Android 3 and above versions. For older versions of Android to have an ActionBar you can use ActionBarSherlock

http://actionbarsherlock.com/

Upvotes: 1

Related Questions