Android Open Source - AndroidStudioProjects Main Activity






From Project

Back to project page AndroidStudioProjects.

License

The source code is released under:

MIT License

If you think the Android project AndroidStudioProjects 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

package alejus.apps101illinoislectures.movingpixels.movingpixels;
//w ww.j  a  v a 2  s.co m
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.SystemClock;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;

import static android.view.View.OnTouchListener;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //instead of constructing our view let0s go back to using XML
        setContentView(R.layout.activity_main);

        /*OLD CODE*/
        //Let's say goodbye to ImageView
        //ImageView image = new ImageView(this);
        //Now we will create our own view:
        //Let's define a class first and then create it
        //View v = new PenguinView(this);
        //Then I better actually have a class that is going to define a PenguinView
        //image.setImageBitmap(b);
        //setContentView(v);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.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();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {

            Intent i = new Intent(this,SettingsActivity.class);
            startActivity(i);

            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}




Java Source Code List

alejus.apps101illinoislectures.javafacts.javafacts.ApplicationTest.java
alejus.apps101illinoislectures.javafacts.javafacts.MainActivity.java
alejus.apps101illinoislectures.movingpixels.movingpixels.ApplicationTest.java
alejus.apps101illinoislectures.movingpixels.movingpixels.MainActivity.java
alejus.apps101illinoislectures.movingpixels.movingpixels.PenguinView.java
alejus.apps101illinoislectures.movingpixels.movingpixels.SettingsActivity.java
alejus.upv.sensores.sensores.ApplicationTest.java
alejus.upv.sensores.sensores.MainActivity.java