volking
asked on
NullPointerException - newbie stumped
When I run below activity, I get an exception. I've wrapped the exception in an AlertDialog. Here's what the dialog shows.
null
null
null
java.lang.NullPointerExcep tion
Where do I even START looking for a problem?
I've commented-out everything I can think of and the exception still happens.
arrrrrgggghhhh!
I'm a newbie and I'm stumped!
Here's the Activity
AlertDialog marked with "">>"
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickL istener;
import android.widget.Button;
public class EncDocRetrieve extends Activity {
Button retrieveDoc;
//EditText DocName;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstan ceState);
try {
setContentView(R.layout.ac tivity_enc _doc_retri eve);
retrieveDoc = (Button) findViewById(R.id.btnRetri eveDoc);
retrieveDoc.setOnClickList ener(new OnClickListener() {
@Override
public void onClick(View v) {
//DocName = (EditText) findViewById(R.id.edtextDo cUserName) ;
Intent intent = new Intent(EncDocRetrieve.this ,
DecryptKeyGet.class);
//intent.putExtra(android. content.In tent.EXTRA _TEXT, DocName
// .getText().toString());
startActivity(intent);
}
});
>> } catch (Exception e) {
>> AlertDialog.Builder dialog = new AlertDialog.Builder(this);
>> dialog.setTitle("Opps Exception");
>> String err = e.getLocalizedMessage() + "\n" + e.getCause() + "\n" + e.getMessage() + "\n" + e.toString();
>> dialog.setMessage(err);
>> dialog.setNeutralButton("C ool", null);
>> dialog.create().show();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate( R.menu.act ivity_enc_ doc_retrie ve, menu);
return true;
}
}
null
null
null
java.lang.NullPointerExcep
Where do I even START looking for a problem?
I've commented-out everything I can think of and the exception still happens.
arrrrrgggghhhh!
I'm a newbie and I'm stumped!
Here's the Activity
AlertDialog marked with "">>"
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickL
import android.widget.Button;
public class EncDocRetrieve extends Activity {
Button retrieveDoc;
//EditText DocName;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstan
try {
setContentView(R.layout.ac
retrieveDoc = (Button) findViewById(R.id.btnRetri
retrieveDoc.setOnClickList
@Override
public void onClick(View v) {
//DocName = (EditText) findViewById(R.id.edtextDo
Intent intent = new Intent(EncDocRetrieve.this
DecryptKeyGet.class);
//intent.putExtra(android.
// .getText().toString());
startActivity(intent);
}
});
>> } catch (Exception e) {
>> AlertDialog.Builder dialog = new AlertDialog.Builder(this);
>> dialog.setTitle("Opps Exception");
>> String err = e.getLocalizedMessage() + "\n" + e.getCause() + "\n" + e.getMessage() + "\n" + e.toString();
>> dialog.setMessage(err);
>> dialog.setNeutralButton("C
>> dialog.create().show();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(
return true;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER