Hello,
I am making an application consisting of 5 views, I get a
NullPointerException when trying to call the next activity from the main
class. I would appreciate it if someone could please have a look at it.
Main class,
public class UIPlay extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
Button green_button = (Button)findViewById(R.id.green);
green_button.setOnClickListener(new OnClickListener(){
public void onClick(View v)
{
Toast.makeText(v.getContext(), "Green Button", 1).show();
Intent i = new Intent(UIPlay.this, GreenActionButton.class);
UIPlay.this.startActivity(i);
}
});
.
.
. //more code continues...
.
public class GreenActionButton extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.green);
.
.
.
.//More code here.
.
.
.
I get a null pointer exception on the onCreate method of the second class.
Also, i see a AndroidManifest.out.xml file being generated everytime i run
in it on my emulator.
Thanks.
Cuil
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en