2014-02-11 7 views
0

제출 버튼을 클릭하면 첫 번째 활동에서 두 번째 활동으로 이동하는 앱을 만들었습니다.하지만 프로젝트를 실행할 때 "불행히도 앱이 중지되었습니다"라는 메시지가 나타납니다. 내 코드를 게시했습니다 .. pls 날 도와 줘요.불행히도 (app_name)이 중지되었습니다

// main_activity (1st activity) 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context=".MainActivity" 
    android:background="#ffff0000"> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/textView2" 
     android:layout_marginTop="23dp" 
     android:text="USER NAME" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="32dp" 
     android:text="REGISTRATION FORM" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <EditText 
     android:id="@+id/editText2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/textView3" 
     android:layout_alignBottom="@+id/textView3" 
     android:layout_alignRight="@+id/editText1" 
     android:ems="10" 
     android:inputType="textPassword" /> 

    <EditText 
     android:id="@+id/editText1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/textView3" 
     android:layout_alignParentRight="true" 
     android:ems="10" 
     android:inputType="textPersonName" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignRight="@+id/textView1" 
     android:layout_below="@+id/editText4" 
     android:layout_marginTop="34dp" 
     android:text="SUBMIT" /> 

    <EditText 
     android:id="@+id/editText3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/textView4" 
     android:layout_alignBottom="@+id/textView4" 
     android:layout_alignParentRight="true" 
     android:ems="10" 
     android:inputType="textEmailAddress" /> 

    <Button 
     android:id="@+id/button2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/button1" 
     android:layout_alignBottom="@+id/button1" 
     android:layout_alignRight="@+id/textView2" 
     android:text="CANCEL" /> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/textView1" 
     android:layout_below="@+id/textView1" 
     android:text="PASSWORD" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <TextView 
     android:id="@+id/textView4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/textView3" 
     android:layout_below="@+id/editText2" 
     android:text="E-MAIL ID" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <EditText 
     android:id="@+id/editText4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignTop="@+id/textView5" 
     android:ems="10" 
     android:inputType="textPostalAddress" > 

     <requestFocus /> 
    </EditText> 

    <TextView 
     android:id="@+id/textView5" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/textView4" 
     android:layout_below="@+id/editText3" 
     android:text="ADDRESS" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

</RelativeLayout> 

registrationform 활성 (활성 2)

<?xml version="1.0" encoding="utf-8"?> 
<AbsoluteLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#ffff0000" > 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="268dp" 
     android:layout_height="wrap_content" 
     android:layout_x="16dp" 
     android:layout_y="238dp" 
     android:text="PLACE ORDER" 
     /> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_x="4dp" 
     android:layout_y="141dp" 
     android:text="YOU HAVE SUCCESSFULLY LOGGED IN" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     tools:context=".RegistrationFormActivity" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_x="90dp" 
     android:layout_y="66dp" 
     android:text="WELCOME" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

</AbsoluteLayout> 

매니페스트 파일

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.pizza" 
    android:versionCode="1" 
    android:versionName="1.0" > 

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

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="com.example.pizza.MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

</manifest> 

main_activity 자바

package com.example.pizza; 

import android.app.Activity; 
import android.content.Context; 
import android.content.Intent; 
import android.os.Bundle; 
import android.view.Menu; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.widget.Button; 

public class MainActivity extends Activity 
{ 

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

    } 
    private void addButtonOnClickEventListener() 
    { 
     // TODO Auto-generated method stub 
     Button button = (Button)findViewById(R.id.button1); 
     final Context context = MainActivity.this; 
     button.setOnClickListener(new OnClickListener() 
     { 

      @Override 
      public void onClick(View v) 
      { 
       // TODO Auto-generated method stub 
       Intent intent = new Intent  (context,RegistrationFormActivity.class); 
       startActivity(intent); 

      } 

     }); 
    } 

    @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; 
    } 

} 

등록 양식 자바 코드

package com.example.pizza; 

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

public class RegistrationFormActivity extends Activity 
{ 
    protected void onCreate(Bundle savedInstanceState){ 

     super.onCreate(savedInstanceState); 
     setContentView(R.layout.registrationform); 
     addButtonOnClickEventListener(); 
    } 
    private void addButtonOnClickEventListener() 
    { 
     // TODO Auto-generated method stub 

    } 

} 

// logcat 

02-11 02 : 46 : 20.049 : D/gralloc_goldfish (1081) : GPU 에뮬레이션이없는 에뮬레이터가 감지되었습니다. 0211 : 46 : 22.899 : D/AndroidRuntime (1081) : VM 종료 중 02-11 02 : 46 : 22.909 : dalvikvm (1081) : threadid = 1 : catch되지 않은 예외로 스레드 종료 중 (그룹 = 0xb4a53b90) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : 치명적인 예외 : 주 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : 프로세스 : com.example.pizza, PID : 1081 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.content.ActivityNotFoundException : 명시 적 활동 클래스를 찾을 수 없습니다. {com.example.pizza/com.example.pizza.RegistrationFormActivity}; AndroidManifest.xml에서이 활동을 선언하셨습니까? 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1628) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : at android.app.Instrumentation.execStartActivity (Instrumentation.java:1424) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.app.Activity.startActivityForResult (Activity.java:3423) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.app.Activity.startActivityForResult (Activity.java:3384) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.app. Activity.startActivity (Activity.java:3626) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.app.Activity.startActivity (Activity.java:3594) 02-11 02:46 : 22.909 : E/AndroidRuntime (1081) : com.example.pizza.MainActivity $ 1.onClick (MainActi vity.java:36) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.view.View.performClick (View.java:4424) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.view.View $ PerformClick.run (View.java:18383) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.os.Handler.handleCallback (Handler. java : 733) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.os.Handler.dispatchMessage (Handler.java:95) 02-11 02 : 46 : 22.909 : E/AndroidRuntime 1081) : android.os.Looper.loop (Looper.java:137) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : android.app.ActivityThread.main (ActivityThread.java:4998) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : java.lang.reflect.Method.invokeNative (기본 메소드) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (108 1) : at java.lang.reflect.Method.invoke (Method.java:515) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : com.android.internal.os.ZygoteInit $ MethodAndArgsCaller. 실행 (ZygoteInit.java:777) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : com.android.internal.os.ZygoteInit.main (ZygoteInit.java:593) 02-11 02 : 46 : 22.909 : E/AndroidRuntime (1081) : dalvik.system.NativeStart.main (기본 메소드) 02-11 02 : 46 : 32.989 : I/Process (1081) : 보내는 신호. PID : 1081 SIG : 9 02-11 02:46:37.069 : D/gralloc_goldfish (1107) : GPU 에뮬레이션이없는 에뮬레이터가 감지되었습니다. 02-11 : 46 : 45.309 : D/AndroidRuntime (1107) : VM 종료 중 02-11 02 : 46 : 45.309 : dalvikvm (1107) : threadid = 1 : catch되지 않은 예외로 스레드 종료 중 (그룹 = 0xb4a53b90) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : 치명적인 예외 : 주 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : 프로세스 : com.example.pizza, PID : 1107 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.content.ActivityNotFoundException : 명시 적 활동 클래스를 찾을 수 없습니다. {com.example.pizza/com.example.pizza.RegistrationFormActivity}; AndroidManifest.xml에서이 활동을 선언하셨습니까? 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1628) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : at android.app.Instrumentation.execStartActivity (Instrumentation.java:1424) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.app.Activity.startActivityForResult (Activity.java:3423) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.app.Activity.startActivityForResult (Activity.java:3384) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.app. Activity.startActivity (Activity.java:3626) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.app.Activity.startActivity (Activity.java:3594) 02-11 02:46 : 45.359 : E/AndroidRuntime (1107) : com.example.pizza.MainActivity $ 1.onClick (MainActi vity.java:36) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.view.View.performClick (View.java:4424) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.view.View $ PerformClick.run (View.java:18383) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.os.Handler.handleCallback (처리기. java : 733) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.os.Handler.dispatchMessage (Handler.java:95) 02-11 02 : 46 : 45.359 : E/AndroidRuntime 1107) : android.os.Looper.loop (Looper.java:137) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : android.app.ActivityThread.main (ActivityThread.java:4998) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : java.lang.reflect.Method.invokeNative (기본 메소드) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (110 7) : at java.lang.reflect.Method.invoke (Method.java:515) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : com.android.internal.os.ZygoteInit $ MethodAndArgsCaller. 실행 (ZygoteInit.java:777) 02-11 02 : 46 : 45.359 : E/AndroidRuntime (1107) : com.android.internal.os.ZygoteInit.main (ZygoteInit.java:593) 02-11 02 : 46 : E/AndroidRuntime (1107) : dalvik.system.NativeStart.main (기본 방법)

+7

가 로그 고양이 오류를 게시 다시 시도 ... 당신이 여기에 이미되지 않는 것으로 AbsoluteLayout을 사용하는 이유는 ... 렀지도 (보기에 대한 개인 또는 고유 ID를 사용하여 변경 –

+0

즉, 버튼, 텍스트 뷰 등) .. 다른 경우 가끔은 R.java 동일한보기 상수를 저장할 수 없습니다. 또한 그것을 변경 .. – Ranjit

+0

ur logcat. ** AbsoluteLayout **을 사용하지 마십시오. 사용되지 않습니다. – Piyush

답변

0

편집에서 당신의 AndroidManifest.xml

<activity android:name="com.example.pizza.RegistrationFormAcitvity"></activity> 

또는

<activity android:name="RegistrationFormAcitvity"></activity> 
.

+0

전체 패키지 이름 또는 점 없이는 작동하지 않습니다. – Simon

+0

@ henry4343 Simon은 질문을하지 않습니다. – Piyush

+0

미안하지만, 내 잘못이야 .. 하. – henry4343

관련 문제