DragonFire353
02-04-2011, 09:58 PM
It says I have no errors but when I click the button the application stops responding. Here is the code:
package com.failtestfail.dragonfire353;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class DragonFire353 extends Activity {
Button sephirothButton;
/** Called when the activity is first created. */
Context context=this;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
sephirothButton = (Button)findViewById(R.id.sephirothbutton);
sephirothButton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Context mContext = getApplicationContext();
Dialog sephirothdialog = new Dialog(mContext);
sephirothdialog.setContentView(R.layout.sephiroth) ;
sephirothdialog.setTitle("SEPHIROTH!!!!");
sephirothdialog.setCancelable(true);
TextView sephirothtext = (TextView) sephirothdialog.findViewById(R.id.sephirothtext);
sephirothtext.setText("WINBERRIEZ!!! YO MEATBILLY IS HIGHLY ACTIVE!!!");
ImageView sephirothimage = (ImageView) sephirothdialog.findViewById(R.id.sephirothimage);
sephirothimage.setImageResource(R.drawable.sephiro thuavatar);
sephirothdialog.show();
}
});
}
}
package com.failtestfail.dragonfire353;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class DragonFire353 extends Activity {
Button sephirothButton;
/** Called when the activity is first created. */
Context context=this;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
sephirothButton = (Button)findViewById(R.id.sephirothbutton);
sephirothButton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Context mContext = getApplicationContext();
Dialog sephirothdialog = new Dialog(mContext);
sephirothdialog.setContentView(R.layout.sephiroth) ;
sephirothdialog.setTitle("SEPHIROTH!!!!");
sephirothdialog.setCancelable(true);
TextView sephirothtext = (TextView) sephirothdialog.findViewById(R.id.sephirothtext);
sephirothtext.setText("WINBERRIEZ!!! YO MEATBILLY IS HIGHLY ACTIVE!!!");
ImageView sephirothimage = (ImageView) sephirothdialog.findViewById(R.id.sephirothimage);
sephirothimage.setImageResource(R.drawable.sephiro thuavatar);
sephirothdialog.show();
}
});
}
}