converting a activity to fragment it shows some errors on array adapter : <pre><code>protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    btnScan = (Button)findViewById(R.id.scan);
    listViewIp = (ListView)findViewById(R.id.listviewip);
    bar = (ProgressBar) findViewById(R.id.pbar);
    bar.setVisibility(View.INVISIBLE);

    ipList = new ArrayList();
    adapter = new ArrayAdapter&lt;String&gt;(this,
            android.R.layout.simple_list_item_1, android.R.id.text1, ipList);
    listViewIp.setAdapter(adapter);

    btnScan.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new ScanIpTask().execute();
        }
    });
</code></pre>

<p>convert it to fragment</p>

<p>ArrayList ipList;
    ArrayAdapter adapter;</p>

<pre><code>@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_scan_ip, container, false);

    btnScan = (Button)rootView.findViewById(R.id.scan);
    listViewIp = (ListView)rootView.findViewById(R.id.listviewip);
    bar = (ProgressBar) rootView.findViewById(R.id.pbar);
    bar.setVisibility(View.INVISIBLE);

    ipList = new ArrayList();
    adapter = new ArrayAdapter&lt;String&gt;(this,
            android.R.layout.simple_list_item_1, android.R.id.text1, ipList);
    listViewIp.setAdapter(adapter);

    btnScan.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new ScanIpTask().execute();
        }
    });


    return rootView;
}
</code></pre>

<p>it shows error in this line</p>

<p>adapter = new ArrayAdapter(this,
                android.R.layout.simple_list_item_1, android.R.id.text1, ipList);</p>
