public class A extends B{
............}
Here Class A is my application class and it Extends Class B. Class B
is not an Activity class provided by Android. And class B has extended
View.
Now the problem is beacuase of this structure I am not able to do
certain asctivities like Playing Music, creating new intent as for
that I have to extend Activity class in Class A.
So I don't how I can do that.
I have implemented one solution to play music .
I created other class file which has code to play music and I have
created object of it in Class A. But it is also not working.
The code in class which implmented looks like this.
Using java Syntax Highlighting
- public class C extends Activty
- {
- public void mediaplay()
- {
- try
- {
- MediaPlayer menusound = MediaPlayer.create (C.this ,R.raw.eat);
- menusound.start();
- }
- catch (Exception e)
- {
- Log.e("Sound", "error: " + e.getMessage(), e);
- }
- }
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
and i m creating its object in class A using this:
Using java Syntax Highlighting
- C o = new C();
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
and I use this o object in class A like this:
Using java Syntax Highlighting
- o.mediaplay();
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
But when it is called in C, MediaPlayer.create thorws null pointer
exception.
So how can I solve this?
It will solve some of my problems.
Thanks,
Mitul

