2013-03-21 9 views
2
내 로그 캣은 다음과 같습니다
package com.tchotchke.weatherpaper; 

import android.annotation.TargetApi; 
import android.app.Activity; 
import android.content.Intent; 
import android.os.Build; 
import android.os.Bundle; 
import android.os.Handler; 
import android.view.MotionEvent; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.widget.Button; 

import com.tchotchke.weatherpaper.util.SystemUiHider; 


public class FullscreenActivity extends Activity{ 

    OnClickListener buttons; 

    private static final boolean AUTO_HIDE = true; 
    private static final int AUTO_HIDE_DELAY_MILLIS = 3000; 
    private static final boolean TOGGLE_ON_CLICK = true; 
    private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION; 
    private SystemUiHider mSystemUiHider; 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 

     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_fullscreen); 
     final View controlsView = findViewById(R.id.fullscreen_content_controls); 
     final View contentView = findViewById(R.id.fullscreen_content); 

     Button objects_button = (Button)findViewById(R.id.objects_button); 

     buttons = new OnClickListener(){ 
      @Override 
      public void onClick(View v){ 
       Intent intent = new Intent("com.tchotchke.MYOBJECTS"); 
       startActivity(intent); 
      } 
     }; 
     objects_button.setOnClickListener(buttons); 

     mSystemUiHider = SystemUiHider.getInstance(this, contentView, HIDER_FLAGS); 
     mSystemUiHider.setup(); 
     mSystemUiHider.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener`() {` 
        // Cached values. 
        int mControlsHeight; 
        int mShortAnimTime; 

        @Override 
        @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) 
        public void onVisibilityChange(boolean visible) { 
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { 
          // If the ViewPropertyAnimator API is available 
          // (Honeycomb MR2 and later), use it to animate the 
          // in-layout UI controls at the bottom of the 
          // screen. 
          if (mControlsHeight == 0) { 
           mControlsHeight = controlsView.getHeight(); 
          } 
          if (mShortAnimTime == 0) { 
           mShortAnimTime = getResources().getInteger(
             android.R.integer.config_shortAnimTime); 
          } 
          controlsView.animate() 
            .translationY(visible ? 0 : mControlsHeight) 
            .setDuration(mShortAnimTime); 
         } else { 
          // If the ViewPropertyAnimator APIs aren't 
          // available, simply show or hide the in-layout UI 
          // controls. 
          controlsView.setVisibility(visible ? View.VISIBLE : View.GONE); 
         } 

         if (visible && AUTO_HIDE) { 
          // Schedule a hide(). 
          delayedHide(AUTO_HIDE_DELAY_MILLIS); 
         } 
        } 
       }); 

     contentView.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View view) { 
       if (TOGGLE_ON_CLICK) { 
        mSystemUiHider.toggle(); 
       } else { 
        mSystemUiHider.show(); 
       } }}); } 



    @Override 
    protected void onPostCreate(Bundle savedInstanceState) { 
     super.onPostCreate(savedInstanceState); 

     delayedHide(100); 
    } 

    View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() { 
     @Override 
     public boolean onTouch(View view, MotionEvent motionEvent) { 
      if (AUTO_HIDE) { 
       delayedHide(AUTO_HIDE_DELAY_MILLIS); 
      } 
      return false; 
     } 
    }; 

    Handler mHideHandler = new Handler(); 
    Runnable mHideRunnable = new Runnable() { 
     @Override 
     public void run() { 
      mSystemUiHider.hide(); 
     } 
    }; 

    private void delayedHide(int delayMillis) { 
     mHideHandler.removeCallbacks(mHideRunnable); 
     mHideHandler.postDelayed(mHideRunnable, delayMillis); 
    } 



    } 

, 내 응용 프로그램에 관계없이 내가 온 클릭을 구현하는 방법의 충돌

여기
- 03-21 15:57:30.871: D/gralloc_goldfish(1034): Emulator without GPU emulation detected. 

-03-21 15:57:31.812: I/Choreographer(1034): Skipped 107 frames! The application may be doing too much work on its main thread. 

-03-21 15:57:32.531: D/dalvikvm(1034): GC_CONCURRENT freed 185K, 11% free 2580K/2896K, paused 3ms+3ms, total 197ms 

-03-21 15:57:51.971: I/Choreographer(1034): Skipped 32 frames! The application may be doing too much work on its main thread. 

-03-21 15:57:58.684: D/AndroidRuntime(1034): Shutting down VM 

-03-21 15:57:58.692: W/dalvikvm(1034): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): FATAL EXCEPTION: main 

-03-21 15:57:58.702: E/AndroidRuntime(1034): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.tchotchke.MYOBJECTS } 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.app.Activity.startActivityForResult(Activity.java:3370) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.app.Activity.startActivityForResult(Activity.java:3331) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.app.Activity.startActivity(Activity.java:3566) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.app.Activity.startActivity(Activity.java:3534) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at com.tchotchke.weatherpaper.FullscreenActivity$3.onClick(FullscreenActivity.java:40) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.view.View.performClick(View.java:4204) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.view.View$PerformClick.run(View.java:17355) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.os.Handler.handleCallback(Handler.java:725) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.os.Handler.dispatchMessage(Handler.java:92) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.os.Looper.loop(Looper.java:137) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at android.app.ActivityThread.main(ActivityThread.java:5041) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at java.lang.reflect.Method.invokeNative(Native Method) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at java.lang.reflect.Method.invoke(Method.java:511) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 

-03-21 15:57:58.702: E/AndroidRuntime(1034): at dalvik.system.NativeStart.main(Native Method) 

내가 내 매니페스트 죄송합니다 (단추를 클릭 할 때까지 오류가 없었다) 그것을 왼쪽 :

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

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

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 

     <activity 
      android:name="com.tchotchke.weatherpaper.FullscreenActivity" 
      android:configChanges="orientation|keyboardHidden|screenSize" 
      android:label="@string/app_name" 
      android:theme="@style/FullscreenTheme" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name="com.tchotchke.weatherpaper.MyObjects" 
      android:label="@string/dummy_button"> 
      <action android:name="android.intent.action.MYOBJECTS"/> 
     </activity> 


    </application> 

</manifest> 

내가 어떻게 매니페스트 작품에 있지만에서 고체 아니에요 내가 봤는데 무엇 합법적

+2

'활동이 의도 {행위 = com.tchotchke.MYOBJECTS}'유 권리 manifast.xml에서 활동 등록되어 있는지 확인을 처리하기 위해 발견 언급 액션 –

+0

당신은 당신이 아마 View.onClickListener을 구현 안드로이드를 지금까지 해봤 MYOBJECTS – HeatfanJohn

+0

의 활동을 누락, 당신의 AndroidManifest.xml 파일을 게시 할 수 : 온 클릭 은 일반적으로 MyObjects.java – Sanduu

답변

4

자사의 N 보인다에서 귀하의 활동을 찾으려면 "com.tchotchke.MYOBJECTS, 귀하는 귀하의 선언 안에서이 활동을 선언해야합니다. 이것이 프로젝트 내 활동 인 경우 의도는 일반적으로 다음과 같은 방식으로 수행됩니다.

Intent intent = new Intent(YourCurrentClassName.this, MYOBJECTS.class); 
startActivity(intent); 

희망이 있습니다. 그것은 위의에서 수행 할 수

0
Intent intent = new Intent(this, MYOBJECTS.class); 
intent.setAction("com.tchotchke.MYOBJECTS"); 
startActivity(intent); 

안녕하세요 친구는 방법