Thursday, April 19, 2012

Two simple [probably] coding questions

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<EditText
android:id="@+id/etNum"
android:layout_width="wrap_content"
android:layout_height="102dp"
android:hint="@string/Please enter a department number."
android:inputType="number"
/>

<EditText
android:id="@+id/etName"
android:layout_width="wrap_content"
android:layout_height="102dp"
android:hint="@string/Or enter a department name."
android:inputType="string"
/>

<requestFocus />


</LinearLayout>


** Q#1. Right at the last line, i get Multiple annotations found at this line:
- error: Error parsing XML: mismatched tag
- This text field does not specify an inputType
or a hint. Not sure what to do? **



package walmart.namespace;


import android.R;
import android.R.string;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class WalmartActivity extends Activity {
/** Called when the activity is first created. */

int department;
String name;
Button search;
TextView display;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);


q#2: For the R.Layout.main, i have 'main cannot be resolved or is not a field'. I know i shouldn't use the import android.R in the imports, but it at least gets rid of the problem being the R. Any ideas on how to fix this?





No comments:

Post a Comment