Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: I got this error and I don't know how to resolve this

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Thanked 0 Times in 0 Posts

    Default I got this error and I don't know how to resolve this

    I got this error:
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.MediaController.setAnchorView(andro id.view.View)' on a null object reference

    This is my code

    public class SymptomArrayAdapter extends ArrayAdapter<Symptom> {
        private MediaController mc;
        public SymptomArrayAdapter(Context context, List<Symptom> objects) {
            super(context, -1, objects);
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater layoutInflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View listViewItem = layoutInflater.inflate(R.layout.symptomlistitem, parent, false);
            TextView txtSymptom = (TextView)listViewItem.findViewById(R.id.txtSymptom);
            final VideoView videoSymptom = (VideoView) listViewItem.findViewById(R.id.videoSymptom);
            Symptom symptom = this.getItem(position);
            videoSymptom.setVideoURI(Uri.parse("android.resource://com.example.speechrecogniser/" + (symptom.getVideo())));
            videoSymptom.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view) {
            return listViewItem;

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,710 Times in 2,660 Posts

    Default Re: I got this error and I don't know how to resolve this

    What variable has the null value? Where is that variable assigned a valid value?
    What statement threw the NullPointerException?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. how to resolve awt-eventqueue-0 java.lang.nullpointerexception
    By java2 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: September 5th, 2014, 03:14 AM
  2. [SOLVED] I want us to help me to resolve my duty in JavaScript
    By arwa qashqari in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 17th, 2014, 12:35 PM
  3. Cannot Resolve Symbol Error
    By tyeeeee1 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: December 6th, 2012, 05:12 PM
  4. What's wrong with my code?? (it said cannot resolve symbol)
    By sakura_smile in forum What's Wrong With My Code?
    Replies: 23
    Last Post: June 11th, 2012, 06:55 AM