ListView is not working in android activity and throwing missing resource ID error of textView

 

I am new in android development and trying to use ListView in my simple app. But it is not working and throwing error.

Here is the code of DisplayMessageActivity.java. I have created a String Array and putted value manually. I am calling resource ID using what we call custom adapter.

package com.example.myfirstapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import java.util.List;

public class DisplayMessageActivity extends AppCompatActivity {
String[] mobileArray={"A", "B"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_display_message);
        Intent intent=getIntent();
        String message=intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
        TextView textView=(TextView) findViewById(R.id.textView);
        textView.setText(message);
        System.out.println("seq");
        ArrayAdapter adapter=new ArrayAdapter<String>(this, R.layout.activity_display_message, R.id.listView, mobileArray);
        System.out.println("seq2");
        ListView listView=(ListView) findViewById(R.id.listView);
        System.out.println("seq3");
        listView.setAdapter(adapter);
        System.out.println("seq44");
    }
}

XML of activity_display_message.xml is below where I created one ListView.

Add Comment -->
   
Java         Android         XML         Listview        
Your Answer: 

0 Answers
Edit Account
LOGIN INFORMATION
Change Settings
Email Notifications Notifications will be sent to abcd@gmail.com
Select option for your email notifications:
Mature / News Filter We'll send on email when new jobs are posted
Option 2 for email notification We'll send on email when new jobs are posted