2013-09-21 2 views
0

저는 아주 새로운데. 오류 경고가 없지만 테스트 할 때 불행하게도 작동이 멈 춥니 다. AVD 램 값을 변경했지만 여전히 작동하지 않습니다. 휴대폰으로 내 보내려했지만 설치가되지 않았습니다.내 앱이 AVD에서 작동하지 않습니다.

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.abdo" 
    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/FullscreenTheme" > 
     <activity 
      android:name="com.abdo.MainActivity" 
      android:label="@string/app_name" 
      android:theme="@android:style/Theme.NoTitleBar" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name="com.abdo.ManuActivity" 
      android:label="@string/title_activity_manu" > 
     </activity> 
    </application> 

</manifest> 
+0

예외가 있는지 'logcat'을 확인하십시오. –

답변

0
  • package com.abdo; 
    
    import android.app.Activity; 
    import android.content.Intent; 
    import android.os.Bundle; 
    import android.util.Log; 
    import android.view.View; 
    import android.view.View.OnClickListener; 
    import android.widget.Button; 
    import android.widget.Toast; 
    
    public class MainActivity extends Activity { 
    
    private static String logtag = "TwoButtonApp";//for use as the tag when logging 
    
    /** Called when the activity is first created. */ 
        @Override 
        public void onCreate(Bundle savedInstanceState) { 
         super.onCreate(savedInstanceState); 
         setContentView(R.layout.main); 
    
         Button buttonStart = (Button)findViewById(R.id.buttonStart);   
        buttonStart.setOnClickListener(startListener); // Register the onClick listener with the implementation above 
    
        Button buttonStop = (Button)findViewById(R.id.buttonStop);   
        buttonStop.setOnClickListener(stopListener); // Register the onClick listener with the implementation above 
        } 
    
        //Create an anonymous implementation of OnClickListener 
        private OnClickListener startListener = new OnClickListener() { 
         public void onClick(View v) { 
          Log.d(logtag,"onClick() called - start button"); 
          Intent a = new Intent(MainActivity.this, ManuActivity.class); 
          startActivity(a); 
    
          Log.d(logtag,"onClick() ended - start button"); 
         } 
        }; 
    
        // Create an anonymous implementation of OnClickListener 
        private OnClickListener stopListener = new OnClickListener() { 
         public void onClick(View v) { 
         Log.d(logtag,"onClick() called - stop button"); 
         Toast.makeText(MainActivity.this, "The Stop button was clicked.", Toast.LENGTH_LONG).show(); 
          Log.d(logtag,"onClick() ended - stop button"); 
         } 
        }; 
    
    
        @Override 
    protected void onStart() {//activity is started and visible to the user 
        Log.d(logtag,"onStart() called"); 
        super.onStart(); 
    } 
    @Override 
    protected void onResume() {//activity was resumed and is visible again 
        Log.d(logtag,"onResume() called"); 
        super.onResume(); 
    
    } 
    @Override 
    protected void onPause() { //device goes to sleep or another activity appears 
        Log.d(logtag,"onPause() called");//another activity is currently running (or user has pressed Home) 
        super.onPause(); 
    
    } 
    @Override 
    protected void onStop() { //the activity is not visible anymore 
        Log.d(logtag,"onStop() called"); 
        super.onStop(); 
    
    } 
    @Override 
    protected void onDestroy() {//android has killed this activity 
        Log.d(logtag,"onDestroy() called"); 
        super.onDestroy(); 
    } 
    } 
    

    매니페스트 내 활동 파일은 첫째 매니페스트 파일에서 true로 android:debuggable을 설정합니다.

  • 둘째, Android 기기의 설정에서 install apk from unknown sources을 켜고 developer settingsallow to debug through usb 설정을 켜거나 (영어로 전화하는 방법을 모르겠다. 러시아어 인터페이스가 있음).
  • 그런 다음 디버그 모드에서 IDE에서 debug 버튼을 눌러 코드를 실행하십시오.

aftersuper 코드를 작성하려고합니다.

@Override 
protected void onStart() {//activity is started and visible to the user 
    super.onStart(); 
    Log.d(logtag,"onStart() called"); 
} 
관련 문제