Once again I'm stumped... The following code works fine in the Android 2.2 emulator from the SDK and on my Galaxy Nexus (running 4.0.1) but I get a NPE when running the app on Xoom (Android 3.2).
final TextView resNum = (TextView) findViewById(R.id.resNum);
System.out.println(resNum);
resNum.setOnClickListener(new View.OnClickListener() {
String num = resNum.getText().toString();
public void onClick(View v) {
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.parse("tel:" + num));
startActivity(callIntent);
}
});
The above is in the onCreate method (among other things of course).
The NPE occurs when performing a 'read' op on resNum, i.e. the println().
Thanks
The dialer is not available on Xoom. You can find more details in this article.