Android Open Source - NumericPageIndicator Buttons In Landscape Activity






From Project

Back to project page NumericPageIndicator.

License

The source code is released under:

Apache License

If you think the Android project NumericPageIndicator listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (C) 2013 Manuel Peinado//from  ww  w.  jav  a  2 s  .  c om
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.manuelpeinado.numericpageindicator.demo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem;
import com.manuelpeinado.numericpageindicator.demo.R;
import com.viewpagerindicator.PageIndicator;

public class ButtonsInLandscapeActivity extends SherlockActivity {
    private ViewPager viewPager;
    private PageIndicator pageIndicator;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        viewPager = (ViewPager) findViewById(R.id.pager);
        viewPager.setAdapter(new MyPagerAdapter());
        pageIndicator = (PageIndicator) findViewById(R.id.pageIndicator);
        pageIndicator.setViewPager(viewPager);
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            Intent parentActivityIntent = new Intent(this, HomeActivity.class);
            parentActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(parentActivityIntent);
            finish();
            return true;
        }
        return false;
    }
}




Java Source Code List

com.manuelpeinado.numericpageindicator.NumericPageIndicator.java
com.manuelpeinado.numericpageindicator.demo.ActivityInfo.java
com.manuelpeinado.numericpageindicator.demo.BasicUsageActivity.java
com.manuelpeinado.numericpageindicator.demo.ButtonsInLandscapeActivity.java
com.manuelpeinado.numericpageindicator.demo.HomeActivity.java
com.manuelpeinado.numericpageindicator.demo.MyPagerAdapter.java
com.manuelpeinado.numericpageindicator.demo.StylingInLayoutActivity.java
com.manuelpeinado.numericpageindicator.demo.StylingInThemeActivity.java
com.manuelpeinado.numericpageindicator.demo.StylingProgrammaticallyActivity.java