Q:

android using textviews to print varibles

I am trying to print if there are any cameras on my device and if so how many.  The output shows that there are cameras but will not show me how many?  Is the issue with the textviews im using?
package com.example.cam_test2;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.view.Menu;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
checkCameraHardware(getApplicationContext());
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

/** Check if this device has a camera */
private boolean checkCameraHardware(Context context) {
if   (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)){
    // this device has a camera
    LinearLayout lView = new LinearLayout(this);

    TextView myText = new TextView(this);

    myText.setText("yes");

    lView.addView(myText);

    setContentView(lView);
    return true;
} else {
    // no camera on this device
    LinearLayout lView = new LinearLayout(this);

    TextView myText = new TextView(this);
    myText.setText("no");

    lView.addView(myText);

    setContentView(lView);

    return false;
}
}

/** A safe way to get an instance of the Camera object. */
public static Camera getCameraInstance(){
int camNum;
camNum=Camera.getNumberOfCameras() ;

TextView myTextView = null;
myTextView.setText("There are " + camNum+" cameras available");

Camera c = null;
try {
    c = Camera.open(); // attempt to get a Camera instance
}
catch (Exception e){
    // Camera is not available (in use or does not exist)
}
return c; // returns null if camera is unavailable
}
}

A:

getCameraInstance() is never called
myTextView is null
myTextView is not added into any layout

