Android Open Source - ExpertAndroid Base Activity

From Project

Back to project page ExpertAndroid.


The source code is released under:

MIT License

If you think the Android project ExpertAndroid 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 com.iuriio.demos.expertandroid.ch13parsesimple;
//www  . j av  a 2s . c  om
import android.content.DialogInterface;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

 * Created by iuriio on 10/30/13.
public abstract class BaseActivity extends ActionBarActivity {
    private static String TAG = null;

    private ProgressDialog pd = null;

    public BaseActivity(String tag) {
        TAG = tag;

    public void reportBack(String message) {
        this.reportBack(TAG, message);

    public void reportBack(String tag, String message) {
        Log.d(tag, message);

    public void reportTransient(String message) {
        this.reportTransient(TAG, message);

    public void reportTransient(String tag, String message) {
        String s = tag + ":" + message;
        Toast toast = Toast.makeText(this, s, Toast.LENGTH_SHORT);;
        this.reportBack(tag, message);

    public boolean invalidString(String s) {
        return StringUtils.invalidString(s);

    public boolean validString(String s) {
        return StringUtils.validString(s);

    public void gotoActivity(Class activityClassReference) {
        final Intent i = new Intent(this, activityClassReference);

    public void turnOnProgressDialog(String title, String message) {
        this.pd =, title, message);

    public void turnOffProgressDialog() {

    public void alert(String title, String message) {
        AlertDialog alertDialog = new AlertDialog.Builder(this).create();
        alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {


    public boolean validateForm() {
        return true;

Java Source Code List