Android App using wifimanager in OnTouch event
<p>I have one class defined as</p>

<pre><code>public class LearningMap extends Activity implements OnTouchListener
</code></pre>

<p>It is defined inside the <code>onTouch</code> method.</p>

<p>I am tring to use wifimanager by calling:</p>

<pre><code>myWifiManager.startScan();
</code></pre>

<p>I defined </p>

<pre><code>myWifiManager = (WifiManager) getBaseContext().getSystemService(Context.WIFI_SERVICE);
</code></pre>

<p>inside the <code>onCreate</code></p>

<p>I got the following error </p>

<blockquote>
  <p>02-05 23:51:21.136: E/AndroidRuntime(17542):
  java.lang.NullPointerException</p>
</blockquote>

<p>at that line where I used myWifiManager.startScan();  inside OnTouch method</p>

<p>What should I do ?</p>
