2012-02-14 66 views
0

我'有問題打電話的意圖出關我的應用程序 所以說我有主類 通過意向[A] 我無法調用下載類[B]的Android使用意圖

類都具有自己的佈局等功能

Main.java:

[...] 
     Intent i = new Intent(".downloader"); 
     startActivity(i); 
     // toaster("Please wait..."); 
[...] 

downloader.java:

public class dowloader extends Activity { 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.downloader); 



    } 
} 

Androidmanifest:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="folder.hide.alexander.fuchs" 
    android:versionCode="3" 
    android:versionName="1.3.1" > 

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

<supports-screens 
android:largeScreens="true" 
android:normalScreens="true" 
android:smallScreens="true" 
android:resizeable="true" 
android:anyDensity="true" 
/> 


<uses-permission android:name="android.permission.INTERNET" /> 

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <activity 
      android:name=".App" 
      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=".downloader" /> 
    </application> 

</manifest> 

請幫我 並感謝您

的logcat:

02-14 14:07:42.539: E/AndroidRuntime(32755): FATAL EXCEPTION: main 
02-14 14:07:42.539: E/AndroidRuntime(32755): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=.downloader } 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.app.Activity.startActivityForResult(Activity.java:2833) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.app.Activity.startActivity(Activity.java:2959) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at folder.hide.alexander.fuchs.App.onClick(App.java:333) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.view.View.performClick(View.java:2538) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.view.View$PerformClick.run(View.java:9152) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.os.Handler.handleCallback(Handler.java:587) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.os.Handler.dispatchMessage(Handler.java:92) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.os.Looper.loop(Looper.java:130) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at android.app.ActivityThread.main(ActivityThread.java:3691) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at java.lang.reflect.Method.invokeNative(Native Method) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at java.lang.reflect.Method.invoke(Method.java:507) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665) 
02-14 14:07:42.539: E/AndroidRuntime(32755): at dalvik.system.NativeStart.main(Native Method) 

回答

3

使用你的意圖是這樣的。

Intent intent = new Intent(yourCurrentClass.this, 
        nextClass.class); 
      startActivity(intent); 

希望這有助於...

0

使用此爲意圖:

Intent in=new Intent(Hello.this,welcome.class); 
startActivity(in); 
0

如果您的班級正在實施onClickListener(說),然後用下面的創建意圖

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

如果您將單擊事件偵聽器作爲匿名內部類提供,請使用以下

Intent intent = new Intent(CurrentClassName.this, DestinationClassName.class); 
startActivity(intent); 
0
Intent intent = new Intent(CurrentClass.this, downloader.class); 
startActivity(intent);