当前位置:操作系统 > 安卓/Android >>

The JAR file D:/..../android.jar has no source attachment

\

解决

       1、下载android源码,下载地址:http://download.csdn.net/detail/gogler/4046554

       2、将android源码发到如下位置:\

 3、配置eclipse:

\

\



 

  4、查看API内容,比如Service.class的原定义如下:

[html]
/* 
 * Copyright (C) 2006 The Android Open Source Project 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */ 
 
package android.app; 
 
import android.content.ComponentCallbacks2; 
import android.content.ComponentName; 
import android.content.Intent; 
import android.content.ContextWrapper; 
import android.content.Context; 
import android.content.res.Configuration; 
import android.os.Build; 
import android.os.RemoteException; 
import android.os.IBinder; 
import android.util.Log; 
 
import java.io.FileDescriptor; 
import java.io.PrintWriter; 
 
/** 
 * A Service is an application component representing either an application's desire 
 * to perform a longer-running operation while not interacting with the user 
 * or to supply functionality for other applications to use.  Each service 
 * class must have a corresponding 
 * {@link android.R.styleable#AndroidManifestService <service>} 
 * declaration in its package's <code>AndroidManifest.xml</code>.  Services 
 * can be started with 
 * {@link android.content.Context#startService Context.startService()} and 
 * {@link android.content.Context#bindService Context.bindService()}. 
 *  
 * <p>Note that services, like other application objects, run in the main 
 * thread of their hosting process.  This means that, if your service is going 
 * to do any CPU intensive (such as MP3 playback) or blocking (such as 
 * networking) operations, it should spawn its own thread in which to do that 
 * work.  More information on this can be found in 
 * <a href="{@docRoot}guide/topics/fundamentals/processes-and-threads.html">Processes and 
 * Threads</a>.  The {@link IntentService} class is available 
 * as a standard implementation of Service that has its own thread where it 
 * schedules its work to be done.</p> 
 *  
 * <p>Topics covered here: 
 * <ol> 
 * <li><a href="#WhatIsAService">What is a Service?</a> 
 * <li><a href="#ServiceLifecycle">Service Lifecycle</a> 
 * <li><a href="#Permissions">Permissions</a> 
 * <li><a href="#ProcessLifecycle">Process Lifecycle</a> 
 * <li><a href="#LocalServiceSample">Local Service Sample</a> 
 * <li><a href="#RemoteMessengerServiceSample">Remote Messenger Service Sample</a> 
 * </ol> 
 * 
 * <div class="special reference"> 
 * <h3>Developer Guides</h3> 
 * <p>For a detailed discussion about how to create services, read the 
 * <a href="{@docRoot}guide/topics/fundamentals/services.html">Services</a> developer guide.</p> 
 * </div> 
 * 
 * <a name="WhatIsAService"></a> 
 * <h3>What is a Service?</h3> 
 *  
 * <p>Most confusion about the Service class actually revolves around what 
 * it is <em>not</em>:</p> 
 *  
 * <ul> 
 * <li> A Service is <b>not</b> a separate process.  The Service object itself 
 * does not imply it is running in its own process; unless otherwise specified, 
 * it runs in the same process as the application it is part of. 
 * <li> A Service is <b>not</b> a thread.  It is not a means itself to do work off 
 * of the main thread (to avoid Application Not Responding errors). 
 * </ul> 
 *  
 * <p>Thus a Service itself is actually very 易做图, providing two main features:</p> 
 *  
 * <ul> 
 * <li>A facility for the application to tell the system <em>about</em> 
 * something it wants to be doing in the background (even when the user is not 
 * directly interacting with the application).  This corresponds to calls to 
 * {@link android.content.Context#startService Context.startService()}, which 
 * ask the system to schedule work for the service, to be run until the service 
 * or someone else explicitly stop it. 
 * <li>A facility for an application to expose some of its functionality to 
 * other applications.  This corresponds to calls to 
 * {@link android.content.Context#bindService Context.bindService()}, which 
 * allows a long-standing connection to be made to the service in order to 
 * interact with it. 
 * </ul> 
 *  
 * <p>When a Service component is actually created, for either of these reasons, 
 * all that the system actually does is instantiate the component 
 * and call its {@link #onCreate} and any other appropriate callbacks on the 
 * main thread.  It is up to the Service to implement these with the appropriate 
 * behavior, such as creating a secondary thread in which it does its work.</p> 
 *  
 * <p>Note that because Service itself is so 易做图, you can make your 
 * interaction with it as 易做图 or complicated as you want: from treating it 
 * as a local Java object that you make direct method calls on (as illustrated 
 * by <

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,