0

How to detect the layout error ? if i start the eclipse and open the first Activity with layout. but the first Activity.java file is gave some error in the SetContentView(R.layout.main) .am using latest Sdk API 16.

package com.eConnect.Restaurant;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class LoginActivity extends Activity {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
     getMenuInflater().inflate(R.menu.main, menu);
     return true;
  }
}

main.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/LinearLayout1"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#000000"
  android:orientation="vertical" >

  <ImageView
    android:id="@+id/imageView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dip"
    android:contentDescription="@string/desc"
    android:src="@drawable/econnect_logo" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dip"
    android:text="@string/uid"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dip"
    android:background="#ffffff"
    android:hint="@string/uid"
    android:inputType="number"
    android:textColor="#9966cc" >

    <requestFocus />
</EditText>

<TextView
    android:id="@+id/textView2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dip"
    android:text="@string/PW"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<EditText
    android:id="@+id/editText2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dip"
    android:background="#ffffff"
    android:hint="@string/PW"
    android:inputType="numberPassword"
    android:textColor="#9966cc" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dip"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="#ff0000"
    android:textStyle="bold" />

<Button
    android:id="@+id/button1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dip"
    android:background="#cccccc"
    android:text="@string/bt"
    android:textColor="#006600"
    android:textStyle="bold" />

androidmanifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.eConnect.Restaurant"
  android:versionCode="1"
  android:versionName="1.0" >

  <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

  <application
     android:icon="@drawable/ic_launcher"
     android:label="@string/app_name"
     android:theme="@style/AppTheme" >
     <activity
        android:name=".LoginActivity"
        android:label="@string/title_activity_login" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
  </application>

</manifest>
RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166
USER5762
  • 277
  • 5
  • 14

2 Answers2

1

First clean your project.By using Project > Clean.Another thing you have to do is delete R.Java from list.Again clean the project.Try this one and let me know.

Akshay
  • 2,506
  • 4
  • 34
  • 55
  • our R.java file is not displayed after delete and clean wat i do – USER5762 Aug 04 '12 at 06:52
  • @CharuPriya What error you are getting in your xml file or logcat or console ? – Akshay Aug 04 '12 at 06:57
  • @CharuPriya Now what error you are having in your ErroLog or in xml file? – Akshay Aug 04 '12 at 10:38
  • i have some pbm in the another layout.i am used the edittext inside the multi Column custom listView, bt i cant able to select the listView items.bcos the list items are cant clickable. – USER5762 Aug 06 '12 at 06:36
  • @CharuPriya You can set the listener for your listView by using setOnClickListener(). And another thing you have to ask it in separate question. :) – Akshay Aug 06 '12 at 07:48
0

Build your project once.I also face this but when i build my project the error vanishes

user1387035
  • 209
  • 4
  • 9