Android Open Source - secondary-dex-gradle Main Activity






From Project

Back to project page secondary-dex-gradle.

License

The source code is released under:

Apache License

If you think the Android project secondary-dex-gradle 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) 2014 Mohit Kanwal./*from   w w  w  .  j a v a 2  s. c  o m*/
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this
 * software and associated documentation files (the "Software"), to deal in the Software
 * without restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or
 * substantial portions of the Software.
 */
package com.github.creativepsyco.secondarydex;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.github.creativepsyco.secondarydex.bigmodule.lib.MyLoader;
import com.github.creativepsyco.secondarydex.bigmodule.lib.SecondActivity;
import com.google.common.base.Strings;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // After the DEX is loaded we can simply access class like this:
        // No need for runtime casts
        Strings.isNullOrEmpty("");
        MyLoader loader = new MyLoader();
        loader.run();

        // Lets load up the second activity also, which was defined in second Dex file
        findViewById(R.id.btn_second).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this, SecondActivity.class);
                startActivity(intent);
            }
        });
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}




Java Source Code List

com.github.creativepsyco.secondarydex.MainActivity.java
com.github.creativepsyco.secondarydex.MyApp.java
com.github.creativepsyco.secondarydex.bigmodule.lib.MyLoader.java
com.github.creativepsyco.secondarydex.bigmodule.lib.SecondActivity.java
com.github.creativepsyco.secondarydex.plugin.FrameworkHack.java
com.github.creativepsyco.secondarydex.plugin.SecondaryDex.java