Android Open Source - AndroidTrainingCode Activity C






From Project

Back to project page AndroidTrainingCode.

License

The source code is released under:

Apache License

If you think the Android project AndroidTrainingCode 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) 2012 The Android Open Source Project
 *//w  ww.  j av 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.example.android.lifecycle;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.example.android.lifecycle.util.StatusTracker;
import com.example.android.lifecycle.util.Utils;

/**
 * Example Activity to demonstrate the lifecycle callback methods.
 */
public class ActivityC extends Activity {

    private String mActivityName;
    private TextView mStatusView;
    private TextView mStatusAllView;
    private StatusTracker mStatusTracker = StatusTracker.getInstance();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_c);
        mActivityName = getString(R.string.activity_c_label);
        mStatusView = (TextView)findViewById(R.id.status_view_c);
        mStatusAllView = (TextView)findViewById(R.id.status_view_all_c);
        mStatusTracker.setStatus(mActivityName, getString(R.string.on_create));
        Utils.printStatus(mStatusView, mStatusAllView);
    }

    @Override
    protected void onStart() {
        super.onStart();
        mStatusTracker.setStatus(mActivityName, getString(R.string.on_start));
        Utils.printStatus(mStatusView, mStatusAllView);
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        mStatusTracker.setStatus(mActivityName, getString(R.string.on_restart));
        Utils.printStatus(mStatusView, mStatusAllView);
    }

    @Override
    protected void onResume() {
        super.onResume();
        mStatusTracker.setStatus(mActivityName, getString(R.string.on_resume));
        Utils.printStatus(mStatusView, mStatusAllView);
    }

    @Override
    protected void onPause() {
        super.onPause();
        mStatusTracker.setStatus(mActivityName, getString(R.string.on_pause));
        Utils.printStatus(mStatusView, mStatusAllView);
    }

    @Override
    protected void onStop() {
        super.onStop();
        mStatusTracker.setStatus(mActivityName, getString(R.string.on_stop));
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mStatusTracker.setStatus(mActivityName, getString(R.string.on_destroy));
    }

    public void startDialog(View v) {
        Intent intent = new Intent(ActivityC.this, DialogActivity.class);
        startActivity(intent);
    }

    public void startActivityA(View v) {
        Intent intent = new Intent(ActivityC.this, ActivityA.class);
        startActivity(intent);
    }

    public void startActivityB(View v) {
        Intent intent = new Intent(ActivityC.this, ActivityB.class);
        startActivity(intent);
    }

    public void finishActivityC(View v) {
        ActivityC.this.finish();
    }
}




Java Source Code List

com.example.android.animationsdemo.ApplicationTest.java
com.example.android.animationsdemo.CardFlipActivity.java
com.example.android.animationsdemo.CrossfadeActivity.java
com.example.android.animationsdemo.LayoutChangesActivity.java
com.example.android.animationsdemo.MainActivity.java
com.example.android.animationsdemo.ScreenSlideActivity.java
com.example.android.animationsdemo.ScreenSlidePageFragment.java
com.example.android.animationsdemo.TouchHighlightImageButton.java
com.example.android.animationsdemo.ZoomActivity.java
com.example.android.lifecycle.ActivityA.java
com.example.android.lifecycle.ActivityB.java
com.example.android.lifecycle.ActivityC.java
com.example.android.lifecycle.ApplicationTest.java
com.example.android.lifecycle.DialogActivity.java
com.example.android.lifecycle.util.StatusTracker.java
com.example.android.lifecycle.util.Utils.java
com.example.android.threadsample.BroadcastNotifier.java
com.example.android.threadsample.Constants.java
com.example.android.threadsample.DataProviderContract.java
com.example.android.threadsample.DataProvider.java
com.example.android.threadsample.DisplayActivity.java
com.example.android.threadsample.PhotoDecodeRunnable.java
com.example.android.threadsample.PhotoDownloadRunnable.java
com.example.android.threadsample.PhotoFragment.java
com.example.android.threadsample.PhotoManager.java
com.example.android.threadsample.PhotoTask.java
com.example.android.threadsample.PhotoThumbnailFragment.java
com.example.android.threadsample.PhotoView.java
com.example.android.threadsample.ProgressNotifier.java
com.example.android.threadsample.RSSPullParser.java
com.example.android.threadsample.RSSPullService.java