相关疑难解决方法(0)

两个发射器活动

我有两个标有intent过滤器的活动

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package"
android:versionCode="1"
android:versionName="1.0" >

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

<application
    android:name=".MyApp"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >

    <!-- work order activity -->
    <activity
        android:name=".app.WorkOrderActivity"
        android:label="@string/work_order"
        android:taskAffinity="com.package.task_for_work_order_activity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <!-- inventory activity -->
    <activity
        android:name=".app.InventoryActivity"
        android:label="@string/inventory"
        android:taskAffinity="com.package.task_for_inventory_activity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
Run Code Online (Sandbox Code Playgroud)

问题是,当我安装apk文件时,没有显示任何活动,因为据我所知,系统无法指定应显示哪些活动.

我真的需要在启动器中显示两个活动,所以请不要提供有关从第二个活动中删除intent-filters的建议,或者如果你这样做,请提供另一种在启动器中显示两个图标的方法.

android android-activity

44
推荐指数
1
解决办法
4万
查看次数

Android在测试包中测试新服务

我想在框架中测试一个类,该框架基于intent启动不同的服务.但是,我有问题,创建TestService内部的androidTest/连接时,Android的测试正在运行.getService方法返回null.

在此先感谢任何指导和帮助!

@RunWith(AndroidJUnit4.class)
public class WakefulIntentSenderTest {
    private static final String SOME_ACTION = "someAction";

    private static class TestService extends Service {
        private boolean mCalled;

        @Override
        public void onCreate() {
            super.onCreate();
        }

        @Override
        public IBinder onBind(final Intent intent) {
            return null;
        }

        @Override
        public int onStartCommand(final Intent intent, final int flags, final int startId) {
            mCalled = true;
            return 0;
        }

        public boolean wasCalled() {
            return mCalled;
        }

        public class TestServiceBinder extends Binder {

        public …
Run Code Online (Sandbox Code Playgroud)

java junit android android-testing android-instrumentation

12
推荐指数
1
解决办法
449
查看次数

仅在带有gradle的调试模式下使用一组类和资源

我想在我处于调试模式构建类型(Android studio/gradle)时添加特定功能.将一组类和资源限制为调试构建类型(gradle).

我目前的解决方案是使用debug目录来存储额外的类和资源,并在代码中,在BuildType.DEBUG属性设置为true时通过反射加载条目类.如果我们在调试中构建,则在构建期间将调试目录与主目录合并.我首先想到这个目录与构建变量目录的工作方式相同,即:将覆盖具有相同名称的类(允许我拥有特定类的调试版本).这似乎是不可能的(来自Android Studio的重复类错误).

这是最干净的解决方案吗?是否可以直接使用gradle来做到这一点?

android gradle android-studio

5
推荐指数
2
解决办法
2692
查看次数

如何修复java.lang.AbstractMethodError:未实现抽象方法

我有这个活动,崩溃的原因是java.lang.AbstractMethodError:未实现抽象方法,我该如何解决?就像我使一些未实现的活动变得活跃起来,但我不知道如何解决!我多次面对这个问题,我不知道如何解决!

public class SelectEndPoint extends AppCompatActivity implements  OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, com.google.android.gms.location.LocationListener {
private GoogleMap mMap;
private GoogleApiClient mGoogleApiClient;
private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
private static String TAG = "MAP LOCATION";
Context mContext;
TextView mLocationMarkerText;
private LatLng mCenterLatLong;


/**
 * Receiver registered with this activity to get the response from FetchAddressIntentService.
 */
private AddressResultReceiver mResultReceiver;
/**
 * The formatted location address.
 */
protected String mAddressOutput;
protected String mAreaOutput;
protected String mCityOutput;
protected String mStateOutput;
EditText mLocationAddress;
TextView mLocationText;
private …
Run Code Online (Sandbox Code Playgroud)

android google-maps

5
推荐指数
1
解决办法
6449
查看次数