Android Open Source - open-radiobrony Error Activity






From Project

Back to project page open-radiobrony.

License

The source code is released under:

Apache License

If you think the Android project open-radiobrony 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.lesikapk.openradiobrony;
//from   w ww.j a v a 2  s . co m
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ErrorActivity extends Activity implements OnClickListener {
  
  Button retryButton;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_error);
    retryButton = (Button)findViewById(R.id.retry_button);
    retryButton.setOnClickListener(this);
    PlayerActivity.getThis().destroyMe();
    PlayerActivity.getThis().cancelSchedule();
  }

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

  @Override
  public void onClick(View v) {
    if(Utils.internetAvailable(getApplicationContext())) {
      Intent playerIntent = new Intent(getApplicationContext(), PlayerActivity.class);
      startActivity(playerIntent);
      overridePendingTransition(0, 0);
      finish();
      overridePendingTransition(0, 0);
    }
    else {
      final AlertDialog.Builder errorDialog = new AlertDialog.Builder(this);
      errorDialog
        .setTitle(R.string.error_title)
        .setMessage(R.string.error_descr_dialog)
        .setCancelable(false)
        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
          
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
            
          }
        })
        .create()
        .show();
    }
  }
  
}




Java Source Code List

.NotificationHelper.java
com.lesikapk.openradiobrony.ErrorActivity.java
com.lesikapk.openradiobrony.ErrorHandler.java
com.lesikapk.openradiobrony.LayoutSuppressingImageView.java
com.lesikapk.openradiobrony.MusicInformation.java
com.lesikapk.openradiobrony.PlayButton.java
com.lesikapk.openradiobrony.PlayerActivity.java
com.lesikapk.openradiobrony.SquareImageView.java
com.lesikapk.openradiobrony.StopButton.java
com.lesikapk.openradiobrony.Utils.java