Example usage for android.util DisplayMetrics DisplayMetrics

List of usage examples for android.util DisplayMetrics DisplayMetrics

Introduction

In this page you can find the example usage for android.util DisplayMetrics DisplayMetrics.

Prototype

public DisplayMetrics() 

Source Link

Usage

From source file:com.SpeechEd.SpeechEdEditActivity.java

/**
 * Called from both onCreate and onConfigurationChanged
 * (if the user switched layouts)//from   w ww.j  av a 2 s  .  c om
 */
private void loadGui() {
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.editor);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    mDensity = metrics.density;

    mMarkerLeftInset = (int) (46 * mDensity);
    mMarkerRightInset = (int) (48 * mDensity);
    mMarkerTopOffset = (int) (10 * mDensity);
    mMarkerBottomOffset = (int) (10 * mDensity);

    mStartText = (TextView) findViewById(R.id.starttext);
    mStartText.addTextChangedListener(mTextWatcher);
    mEndText = (TextView) findViewById(R.id.endtext);
    mEndText.addTextChangedListener(mTextWatcher);

    mPlayButton = (ImageButton) findViewById(R.id.play);
    mPlayButton.setOnClickListener(mPlayListener);
    mRewindButton = (ImageButton) findViewById(R.id.rew);
    mRewindButton.setOnClickListener(mRewindListener);
    mFfwdButton = (ImageButton) findViewById(R.id.ffwd);
    mFfwdButton.setOnClickListener(mFfwdListener);
    mZoomInButton = (ImageButton) findViewById(R.id.zoom_in);
    mZoomInButton.setOnClickListener(mZoomInListener);
    mZoomOutButton = (ImageButton) findViewById(R.id.zoom_out);
    mZoomOutButton.setOnClickListener(mZoomOutListener);
    mSaveButton = (ImageButton) findViewById(R.id.save);
    mSaveButton.setOnClickListener(mSaveListener);

    TextView markStartButton = (TextView) findViewById(R.id.mark_start);
    markStartButton.setOnClickListener(mMarkStartListener);
    TextView markEndButton = (TextView) findViewById(R.id.mark_end);
    markEndButton.setOnClickListener(mMarkStartListener);

    enableDisableButtons();

    mWaveformView = (WaveformView) findViewById(R.id.waveform);
    mWaveformView.setListener(this);

    mInfo = (TextView) findViewById(R.id.info);
    mInfo.setText(mCaption);

    mMaxPos = 0;
    mLastDisplayedStartPos = -1;
    mLastDisplayedEndPos = -1;

    if (mSoundFile != null) {
        mWaveformView.setSoundFile(mSoundFile);
        mWaveformView.recomputeHeights(mDensity);
        mMaxPos = mWaveformView.maxPos();
    }

    mStartMarker = (MarkerView) findViewById(R.id.startmarker);
    mStartMarker.setListener(this);
    mStartMarker.setAlpha(255);
    mStartMarker.setFocusable(true);
    mStartMarker.setFocusableInTouchMode(true);
    mStartVisible = true;

    mEndMarker = (MarkerView) findViewById(R.id.endmarker);
    mEndMarker.setListener(this);
    mEndMarker.setAlpha(255);
    mEndMarker.setFocusable(true);
    mEndMarker.setFocusableInTouchMode(true);
    mEndVisible = true;

    updateDisplay();
}

From source file:com.uzmap.pkg.uzmodules.uzBMap.utils.JsParamsUtil.java

public int getScreenWidth(Activity act) {
    DisplayMetrics metric = new DisplayMetrics();
    act.getWindowManager().getDefaultDisplay().getMetrics(metric);
    return UZCoreUtil.pixToDip(metric.widthPixels);
}

From source file:com.ringdroid.RingdroidEditActivity.java

/**
 * Called from both onCreate and onConfigurationChanged (if the user
 * switched layouts)//  w ww . j ava  2  s  .  co m
 */
private void loadGui() {
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.editor);
    Utils.addAds(this);
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    mDensity = metrics.density;

    mStartText = (TextView) findViewById(R.id.starttext);
    mStartText.addTextChangedListener(mTextWatcher);
    mEndText = (TextView) findViewById(R.id.endtext);
    mEndText.addTextChangedListener(mTextWatcher);

    mPlayButton = (ImageButton) findViewById(R.id.play);
    mPlayButton.setOnClickListener(mPlayListener);
    mRewindButton = (ImageButton) findViewById(R.id.rew);
    mRewindButton.setOnClickListener(mRewindListener);
    mFfwdButton = (ImageButton) findViewById(R.id.ffwd);
    mFfwdButton.setOnClickListener(mFfwdListener);
    mZoomInButton = (ImageButton) findViewById(R.id.zoom_in);
    mZoomInButton.setOnClickListener(mZoomInListener);
    mZoomOutButton = (ImageButton) findViewById(R.id.zoom_out);
    mZoomOutButton.setOnClickListener(mZoomOutListener);
    mSaveButton = (ImageButton) findViewById(R.id.save);
    mSaveButton.setOnClickListener(mSaveListener);

    TextView markStartButton = (TextView) findViewById(R.id.mark_start);
    markStartButton.setOnClickListener(mMarkStartListener);
    TextView markEndButton = (TextView) findViewById(R.id.mark_end);
    markEndButton.setOnClickListener(mMarkStartListener);

    enableDisableButtons();

    mWaveformView = (WaveformView) findViewById(R.id.waveform);
    mWaveformView.setListener(this);

    mInfo = (TextView) findViewById(R.id.info);
    mInfo.setText(mCaption);

    mMaxPos = 0;
    mLastDisplayedStartPos = -1;
    mLastDisplayedEndPos = -1;

    if (mSoundFile != null) {
        mWaveformView.setSoundFile(mSoundFile);
        mWaveformView.recomputeHeights(mDensity);
        mMaxPos = mWaveformView.maxPos();
    }

    mStartMarker = (MarkerView) findViewById(R.id.startmarker);
    mStartMarker.setListener(this);
    mStartMarker.setAlpha(255);
    mStartMarker.setFocusable(true);
    mStartMarker.setFocusableInTouchMode(true);

    mEndMarker = (MarkerView) findViewById(R.id.endmarker);
    mEndMarker.setListener(this);
    mEndMarker.setAlpha(255);
    mEndMarker.setFocusable(true);
    mEndMarker.setFocusableInTouchMode(true);

    updateDisplay();
}

From source file:com.uzmap.pkg.uzmodules.uzBMap.utils.JsParamsUtil.java

public int getScreenHeight(Activity act) {
    DisplayMetrics metric = new DisplayMetrics();
    act.getWindowManager().getDefaultDisplay().getMetrics(metric);
    return UZCoreUtil.pixToDip(metric.heightPixels);
}

From source file:cc.softwarefactory.lokki.android.fragments.MapViewFragment.java

public Bitmap createDrawableFromView(View view) {

    Log.e(TAG, "createDrawableFromView");
    DisplayMetrics displayMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    view.setLayoutParams(new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.WRAP_CONTENT));
    view.measure(displayMetrics.widthPixels, displayMetrics.heightPixels);
    view.layout(0, 0, displayMetrics.widthPixels, displayMetrics.heightPixels);
    view.buildDrawingCache();/*w ww.j av  a  2 s.c  o m*/
    Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(),
            Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(bitmap);
    view.draw(canvas);

    return bitmap;
}

From source file:com.Beat.RingdroidEditActivity.java

/**
 * Called from both onCreate and onConfigurationChanged
 * (if the user switched layouts)/*from   w  ww  . j a  va2 s  . co  m*/
 */
private void loadGui() {
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.editor);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    mDensity = metrics.density;

    mMarkerLeftInset = (int) (46 * mDensity);
    mMarkerRightInset = (int) (48 * mDensity);
    mMarkerTopOffset = (int) (10 * mDensity);
    mMarkerBottomOffset = (int) (10 * mDensity);

    mStartText = (TextView) findViewById(R.id.starttext);
    mStartText.addTextChangedListener(mTextWatcher);
    mEndText = (TextView) findViewById(R.id.endtext);
    mEndText.addTextChangedListener(mTextWatcher);

    mPlayButton = (ImageButton) findViewById(R.id.play);
    mPlayButton.setOnClickListener(mPlayListener);
    mRewindButton = (ImageButton) findViewById(R.id.rew);
    mRewindButton.setOnClickListener(mRewindListener);
    mFfwdButton = (ImageButton) findViewById(R.id.ffwd);
    mFfwdButton.setOnClickListener(mFfwdListener);
    mZoomInButton = (ImageButton) findViewById(R.id.zoom_in);
    mZoomInButton.setOnClickListener(mZoomInListener);
    mZoomOutButton = (ImageButton) findViewById(R.id.zoom_out);
    mZoomOutButton.setOnClickListener(mZoomOutListener);
    mSaveButton = (ImageButton) findViewById(R.id.save);
    mSaveButton.setOnClickListener(mSaveListener);

    TextView markStartButton = (TextView) findViewById(R.id.mark_start);
    markStartButton.setOnClickListener(mMarkStartListener);
    TextView markEndButton = (TextView) findViewById(R.id.mark_end);
    markEndButton.setOnClickListener(mMarkStartListener);

    enableDisableButtons();

    mWaveformView = (WaveformView) findViewById(R.id.waveform);
    mWaveformView.setListener(this);

    mInfo = (TextView) findViewById(R.id.info);
    mInfo.setText(mCaption);

    mMaxPos = 0;
    mLastDisplayedStartPos = -1;
    mLastDisplayedEndPos = -1;

    if (mSoundFile != null) {
        mWaveformView.setSoundFile(mSoundFile);
        mWaveformView.recomputeHeights(mDensity);
        mMaxPos = mWaveformView.maxPos();
    }

    mStartMarker = (MarkerView) findViewById(R.id.startmarker);
    mStartMarker.setListener(this);
    mStartMarker.setAlpha(255);
    mStartMarker.setFocusable(true);
    mStartMarker.setFocusableInTouchMode(true);
    mStartVisible = true;

    mEndMarker = (MarkerView) findViewById(R.id.endmarker);
    mEndMarker.setListener(this);
    mEndMarker.setAlpha(255);
    mEndMarker.setFocusable(true);
    mEndMarker.setFocusableInTouchMode(true);
    mEndVisible = true;

    final AlertDialog.Builder nomp3 = new AlertDialog.Builder(this);
    nomp3.setCancelable(true);
    nomp3.setMessage("Filters Only work on wav files at this time");
    nomp3.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            return;
        }
    });

    Button echo = (Button) findViewById(R.id.echobutton);
    echo.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View clickedButton) {
            if (mExtension.compareToIgnoreCase(".wav") == 0) {
                audioCode.echo(mFilename,
                        mFilename.substring(0, mFilename.lastIndexOf('.')) + "_echo" + mExtension, 200, .6,
                        false);
                reset(mFilename.substring(0, mFilename.lastIndexOf('.')) + "_echo" + mExtension);
            } else
                nomp3.show();
        }
    });
    Button high = (Button) findViewById(R.id.highbutton);
    high.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View clickedButton) {
            if (mExtension.compareToIgnoreCase(".wav") == 0) {
                audioCode.filter(mFilename,
                        mFilename.substring(0, mFilename.lastIndexOf('.')) + "_high" + mExtension, true, 2000);
                reset(mFilename.substring(0, mFilename.lastIndexOf('.')) + "_high" + mExtension);
            } else
                nomp3.show();
        }
    });
    Button low = (Button) findViewById(R.id.Lowbutton);
    low.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View clickedButton) {
            if (mExtension.compareToIgnoreCase(".wav") == 0) {
                audioCode.filter(mFilename,
                        mFilename.substring(0, mFilename.lastIndexOf('.')) + "_low" + mExtension, false, 2000);
                reset(mFilename.substring(0, mFilename.lastIndexOf('.')) + "_low" + mExtension);
            } else
                nomp3.show();
        }
    });
    Button speedup = (Button) findViewById(R.id.up);
    speedup.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View clickedButton) {
            if (mExtension.compareToIgnoreCase(".wav") == 0) {
                audioCode.decreaseTimescaleIncreasePitch(mFilename,
                        mFilename.substring(0, mFilename.lastIndexOf('.')) + "_sup" + mExtension, 2);
                reset(mFilename.substring(0, mFilename.lastIndexOf('.')) + "_sup" + mExtension);
            } else
                nomp3.show();
        }
    });
    Button speeddown = (Button) findViewById(R.id.down);
    speeddown.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View clickedButton) {
            if (mExtension.compareToIgnoreCase(".wav") == 0) {
                audioCode.increaseTimescaleDecreasePitch(mFilename,
                        mFilename.substring(0, mFilename.lastIndexOf('.')) + "_sdown" + mExtension, 2);
                reset(mFilename.substring(0, mFilename.lastIndexOf('.')) + "_sdown" + mExtension);
            } else
                nomp3.show();
        }
    });
    Button record = (Button) findViewById(R.id.record);
    record.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View clickedButton) {
            Intent i = new Intent();
            i.setClassName("com.Beat", "com.Beat.recordScreen");
            startActivity(i);
            exit();
        }
    });

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    updateDisplay();
}

From source file:com.cryart.sabbathschool.viewmodel.SSReadingViewModel.java

@Override
public void onSelectionStarted(float x, float y) {
    if (ssReadingActivityBinding != null) {
        LinearLayout view = ssReadingActivityBinding.ssReadingViewPager.findViewWithTag(
                "ssReadingView_" + ssReadingActivityBinding.ssReadingViewPager.getCurrentItem());
        NestedScrollView scrollView = view.findViewById(R.id.ss_reading_view_scroll);

        y = y - scrollView.getScrollY() + ssReadingActivityBinding.ssReadingViewPager.getTop();

        DisplayMetrics metrics = new DisplayMetrics();
        ((SSReadingActivity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics);
        ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu
                .getLayoutParams();//  www  .  j a v a2s  .co  m

        int contextMenuWidth = ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu.getWidth();
        int contextMenuHeight = ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu.getHeight();

        int screenWidth = metrics.widthPixels;
        int screenHeight = metrics.heightPixels;

        int margin = SSHelper.convertDpToPixels(context, 20);
        int jumpMargin = SSHelper.convertDpToPixels(context, 60);

        int contextMenuX = (int) x - (contextMenuWidth / 2);
        int contextMenuY = scrollView.getTop() + (int) y - contextMenuHeight - margin;

        if (contextMenuX - margin < 0) {
            contextMenuX = margin;
        }

        if (contextMenuX + contextMenuWidth + margin > screenWidth) {
            contextMenuX = screenWidth - margin - contextMenuWidth;
        }

        if (contextMenuY - margin < 0) {
            contextMenuY = contextMenuY + contextMenuHeight + jumpMargin;
        }

        params.setMargins(contextMenuX, contextMenuY, 0, 0);
        ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu.setLayoutParams(params);
        ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu.setVisibility(View.VISIBLE);
        highlightId = 0;
    }
}

From source file:com.vidinoti.pixlive.PixLive.java

private void createARView(final int x, final int y, final int width, final int height, final int ctrlID,
        final boolean insertBelow, final CallbackContext callbackContext) {
    cordova.getActivity().runOnUiThread(new Runnable() {
        public void run() {

            if (imageSender == null) {
                try {
                    imageSender = new DeviceCameraImageSender();
                } catch (IOException e) {
                    VDARSDKController.log(Log.ERROR, TAG, Log.getStackTraceString(e));
                }//from   ww  w. ja v a 2 s .  co m

                VDARSDKController.getInstance().setImageSender(imageSender);
            }

            VDARAnnotationView annotationView = new VDARAnnotationView(cordova.getActivity());

            DisplayMetrics displaymetrics = new DisplayMetrics();

            cordova.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);

            annotationView.setVisibility(View.VISIBLE);

            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                    (int) Math.round(width * displaymetrics.scaledDensity),
                    (int) Math.round(height * displaymetrics.scaledDensity));
            params.leftMargin = (int) Math.round(x * displaymetrics.scaledDensity);
            params.topMargin = (int) Math.round(y * displaymetrics.scaledDensity);

            annotationView.setLayoutParams(params);

            touchView.addView(annotationView, 0);

            arViews.put(ctrlID, annotationView);

            VDARSDKController.getInstance().setActivity(cordova.getActivity());

            annotationView.onResume();

        }
    });
}

From source file:com.processing.core.PApplet.java

/** Called with the activity is first created. */
@Override/*from  w  w  w .  j  a  va 2 s  .  c om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //    println("PApplet.onCreate()");

    if (DEBUG)
        println("onCreate() happening here: " + Thread.currentThread().getName());

    Window window = getWindow();

    // Take up as much area as possible
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);

    // This does the actual full screen work
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    displayWidth = dm.widthPixels;
    displayHeight = dm.heightPixels;
    //    println("density is " + dm.density);
    //    println("densityDpi is " + dm.densityDpi);
    if (DEBUG)
        println("display metrics: " + dm);

    //println("screen size is " + screenWidth + "x" + screenHeight);

    //    LinearLayout layout = new LinearLayout(this);
    //    layout.setOrientation(LinearLayout.VERTICAL | LinearLayout.HORIZONTAL);
    //    viewGroup = new ViewGroup();
    //    surfaceView.setLayoutParams();
    //    viewGroup.setLayoutParams(LayoutParams.)
    //    RelativeLayout layout = new RelativeLayout(this);
    //    RelativeLayout overallLayout = new RelativeLayout(this);
    //    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
    //lp.addRule(RelativeLayout.RIGHT_OF, tv1.getId());
    //    layout.setGravity(RelativeLayout.CENTER_IN_PARENT);

    int sw = sketchWidth();
    int sh = sketchHeight();

    if (sketchRenderer().equals(JAVA2D)) {
        surfaceView = new SketchSurfaceView(this, sw, sh);
    } else if (sketchRenderer().equals(P2D) || sketchRenderer().equals(P3D)) {
        surfaceView = new SketchSurfaceViewGL(this, sw, sh, sketchRenderer().equals(P3D));
    }
    //    g = ((SketchSurfaceView) surfaceView).getGraphics();

    //    surfaceView.setLayoutParams(new LayoutParams(sketchWidth(), sketchHeight()));

    //    layout.addView(surfaceView);
    //    surfaceView.setVisibility(1);
    //    println("visibility " + surfaceView.getVisibility() + " " + SurfaceView.VISIBLE);
    //    layout.addView(surfaceView);
    //    AttributeSet as = new AttributeSet();
    //    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(layout, as);

    //    lp.addRule(android.R.styleable.ViewGroup_Layout_layout_height,
    //    layout.add
    //lp.addRule(, arg1)
    //layout.addView(surfaceView, sketchWidth(), sketchHeight());

    //      new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
    //        RelativeLayout.LayoutParams.FILL_PARENT);

    if (sw == displayWidth && sh == displayHeight) {
        // If using the full screen, don't embed inside other layouts
        window.setContentView(surfaceView);
    } else {
        // If not using full screen, setup awkward view-inside-a-view so that
        // the sketch can be centered on screen. (If anyone has a more efficient
        // way to do this, please file an issue on Google Code, otherwise you
        // can keep your "talentless hack" comments to yourself. Ahem.)
        RelativeLayout overallLayout = new RelativeLayout(this);
        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        lp.addRule(RelativeLayout.CENTER_IN_PARENT);

        LinearLayout layout = new LinearLayout(this);
        layout.addView(surfaceView, sketchWidth(), sketchHeight());
        overallLayout.addView(layout, lp);
        window.setContentView(overallLayout);
    }

    /*
    // Here we use Honeycomb API (11+) to hide (in reality, just make the status icons into small dots)
    // the status bar. Since the core is still built against API 7 (2.1), we use introspection to get
    // the setSystemUiVisibility() method from the view class.
    Method visibilityMethod = null;
    try {
      visibilityMethod = surfaceView.getClass().getMethod("setSystemUiVisibility", new Class[] { int.class});
    } catch (NoSuchMethodException e) {
      // Nothing to do. This means that we are running with a version of Android previous to Honeycomb.
    }
    if (visibilityMethod != null) {
      try {
        // This is equivalent to calling:
        //surfaceView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
        // The value of View.STATUS_BAR_HIDDEN is 1.
        visibilityMethod.invoke(surfaceView, new Object[] { 1 });
      } catch (InvocationTargetException e) {
      } catch (IllegalAccessException e) {
      }
    }
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    */

    //    layout.addView(surfaceView, lp);
    //    surfaceView.setLayoutParams(new LayoutParams(sketchWidth(), sketchHeight()));

    //    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams()
    //    layout.addView(surfaceView, new LayoutParams(arg0)

    // TODO probably don't want to set these here, can't we wait for surfaceChanged()?
    // removing this in 0187
    //    width = screenWidth;
    //    height = screenHeight;

    //    int left = (screenWidth - iwidth) / 2;
    //    int right = screenWidth - (left + iwidth);
    //    int top = (screenHeight - iheight) / 2;
    //    int bottom = screenHeight - (top + iheight);
    //    surfaceView.setPadding(left, top, right, bottom);
    // android:layout_width

    //    window.setContentView(surfaceView);  // set full screen

    // code below here formerly from init()

    //millisOffset = System.currentTimeMillis(); // moved to the variable declaration

    finished = false; // just for clarity

    // this will be cleared by draw() if it is not overridden
    looping = true;
    redraw = true; // draw this guy once
    //    firstMotion = true;

    Context context = getApplicationContext();
    sketchPath = context.getFilesDir().getAbsolutePath();

    //    Looper.prepare();
    handler = new Handler();
    //    println("calling loop()");
    //    Looper.loop();
    //    println("done with loop() call, will continue...");

    start();
}