Note that there are some explanatory texts on larger screens.

plurals
  1. POR.layout.main cannot be resolved to a variable
    primarykey
    data
    text
    <p>I've found this code from Raghav Sood's Pro Android Augmented Reality book. I've tried to execute the code as it is written in the book but yet i am facing so much of difficulties.i've tried cleaning and building of project. Put the checkbox tick in the project's property dialogue box. Checked import Android.R presence in my code. Even i uninstalled my AndroidSDK and reinstalled it with different set of Android versions and APIs. Uninstalled and reinstalled Eclipse.</p> <p>Here is my ProAndroidAR3Activity.java file</p> <pre><code> package com.paar.ch3widgetoverlay; import android.app.Activity; import android.hardware.Camera; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.TextView; public class ProAndroidAR3Activity extends Activity{ SurfaceView cameraPreview; SurfaceHolder previewHolder; Camera camera; boolean inPreview; final static String TAG = "PAAR"; SensorManager sensorManager; int orientationSensor; float headingAngle; float pitchAngle; float rollAngle; int accelerometerSensor; float xAxis; float yAxis; float zAxis; LocationManager locationManager; double latitude; double longitude; double altitude; TextView xAxisValue; TextView yAxisValue; TextView zAxisValue; TextView headingValue; TextView pitchValue; TextView rollValue; TextView altitudeValue; TextView latitudeValue; TextView longitudeValue; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //here is the problem. every part of the code with R. is having problem locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2000, 2, locationListener); sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); orientationSensor = Sensor.TYPE_ORIENTATION; accelerometerSensor = Sensor.TYPE_ACCELEROMETER; sensorManager.registerListener(sensorEventListener, sensorManager.getDefaultSensor(orientationSensor), SensorManager.SENSOR_DELAY_NORMAL); sensorManager.registerListener(sensorEventListener, sensorManager.getDefaultSensor(accelerometerSensor), SensorManager.SENSOR_DELAY_NORMAL); inPreview = false; cameraPreview = (SurfaceView)findViewById(R.id.cameraPreview); previewHolder = cameraPreview.getHolder(); previewHolder.addCallback(surfaceCallback); previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); xAxisValue = (TextView) findViewById(R.id.xAxisValue); yAxisValue = (TextView) findViewById(R.id.yAxisValue); zAxisValue = (TextView) findViewById(R.id.zAxisValue); headingValue = (TextView) findViewById(R.id.headingValue); pitchValue = (TextView) findViewById(R.id.pitchValue); rollValue = (TextView) findViewById(R.id.rollValue); altitudeValue = (TextView) findViewById(R.id.altitudeValue); longitudeValue = (TextView) findViewById(R.id.longitudeValue); latitudeValue = (TextView) findViewById(R.id.latitudeValue); </code></pre> <p>This is the AndroidManifest.xml file of my project:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.paar.ch3widgetoverlay" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="7" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:label="@string/app_name" android:name=".ProAndroidAR3Activity" android:screenOrientation = "landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges = "keyboardHidden|orientation"&gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;uses-feature android:name="android.hardware.camera" /&gt; &lt;uses-permission android:name="android.permission.CAMERA" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;/manifest&gt; </code></pre> <p>The following is the res/layout/main.xml file</p> <pre><code> &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;SurfaceView android:id="@+id/cameraPreview" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;TextView android:id="@+id/xAxisLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="18dp" android:layout_marginTop="15dp" android:text="@string/xAxis" /&gt; &lt;TextView android:id="@+id/yAxisLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/xAxisLabel" android:layout_below="@+id/xAxisLabel" android:text="@string/yAxis" /&gt; &lt;TextView android:id="@+id/zAxisLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/yAxisLabel" android:layout_below="@+id/yAxisLabel" android:text="@string/zAxis" /&gt; &lt;TextView android:id="@+id/headingLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/zAxisLabel" android:layout_below="@+id/zAxisLabel" android:layout_marginTop="19dp" android:text="@string/heading" /&gt; &lt;TextView android:id="@+id/pitchLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/headingLabel" android:layout_below="@+id/headingLabel" android:text="@string/pitch" /&gt; &lt;TextView android:id="@+id/rollLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/pitchLabel" android:layout_below="@+id/pitchLabel" android:text="@string/roll" /&gt; &lt;TextView android:id="@+id/latitudeLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/rollLabel" android:layout_below="@+id/rollLabel" android:layout_marginTop="34dp" android:text="@string/latitude" /&gt; &lt;TextView android:id="@+id/longitudeLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/latitudeLabel" android:layout_below="@+id/latitudeLabel" android:text="@string/longitude" /&gt; &lt;TextView android:id="@+id/altitudeLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/longitudeLabel" android:layout_below="@+id/longitudeLabel" android:text="@string/altitude" /&gt; &lt;TextView android:id="@+id/xAxisValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/xAxisLabel" android:layout_marginLeft="56dp" android:layout_toRightOf="@+id/longitudeLabel" android:text="@string/empty" /&gt; &lt;TextView android:id="@+id/yAxisValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/yAxisLabel" android:layout_alignBottom="@+id/yAxisLabel" android:layout_alignLeft="@+id/xAxisValue" android:text="@string/empty" /&gt; &lt;TextView android:id="@+id/zAxisValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/headingLabel" android:layout_alignLeft="@+id/yAxisValue" android:text="@string/empty" /&gt; &lt;TextView android:id="@+id/headingValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/headingLabel" android:layout_alignBottom="@+id/headingLabel" android:layout_alignLeft="@+id/zAxisValue" android:text="@string/empty" /&gt; &lt;TextView android:id="@+id/pitchValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/pitchLabel" android:layout_alignBottom="@+id/pitchLabel" android:layout_alignLeft="@+id/headingValue" android:text="@string/empty" /&gt; &lt;TextView android:id="@+id/rollValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/latitudeLabel" android:layout_alignLeft="@+id/pitchValue" android:text="@string/empty" /&gt; &lt;TextView android:id="@+id/latitudeValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/latitudeLabel" android:layout_alignLeft="@+id/rollValue" android:text="@string/empty" /&gt; &lt;TextView android:id="@+id/longitudeValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/longitudeLabel" android:layout_alignBottom="@+id/longitudeLabel" android:layout_alignLeft="@+id/latitudeValue" android:text="@string/empty" /&gt; &lt;TextView android:id="@+id/altitudeValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/altitudeLabel" android:layout_alignBottom="@+id/altitudeLabel" android:layout_alignLeft="@+id/longitudeValue" android:text="@string/empty" /&gt; &lt;/RelativeLayout&gt;` </code></pre> <p>The following is the res/values/strings.xml file</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;string name="hello"&gt;Hello World, ProAndroidAR3Activity!&lt;/string&gt; &lt;string name="app_name"&gt;Pro Android AR 3 Widget Overlay&lt;/string&gt; &lt;string name="xAxis"&gt;X Axis:&lt;/string&gt; &lt;string name="yAxis"&gt;Y Axis:&lt;/string&gt; &lt;string name="zAxis"&gt;Z Axis:&lt;/string&gt; &lt;string name="heading"&gt;Heading:&lt;/string&gt; &lt;string name="pitch"&gt;Pitch:&lt;/string&gt; &lt;string name="roll"&gt;Roll:&lt;/string&gt; &lt;string name="altitude"&gt;Altitude:&lt;/string&gt; &lt;string name="longitude"&gt;Longitude:&lt;/string&gt; &lt;string name="latitude"&gt;Latitude:&lt;/string&gt; &lt;string name="empty"&gt;&lt;/string&gt; &lt;/resources&gt; </code></pre> <p>I have set the minsdk version to be 2.1 that is API 7 and the compile SDK version is 4.1 that is API 16...</p> <p>please help me out...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload