小编Sam*_*Sam的帖子

构建两个版本的相同Android应用程序并在同一设备上安装

我需要构建同一个Android应用程序的两个版本并在同一设备上安装,我可以通过保留两个不同的项目(不同的包名称)来实现这一点,但是管理两者都很痛苦,而不是保持两个项目有更好的方法为达到这个.

山姆.

android

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

如何在我的Android项目中使用zxing core作为库?

我正在使用zxing库构建Android扫描应用程序.我构建了zxing核心,并将core.jar包含在我的应用程序构建路径中.我不想使用此网址"http://code.google.com/p/zxing/wiki/ScanningViaIntent"中提供的intent解决方案.

我的问题是:如何打开相机,捕获有争议的图像并传递到zxing核心库进行解码,当解码方法返回成功时停止相机并打印结果?

我发现以下链接对我有用:http://www.arp123.com/post/Identified-in-the-Android-use-ZXing-barcode-QR-Code.html但是我在连续扫描中遇到了问题.与zxing 1.6 Android条码扫描器app相比,我的解决方案并不好.如果有人可以帮助我或引导我解决这个问题,我会非常感激.

android

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

需要动态设置quartz cron表达式

我在我的Web应用程序(Servlet Web应用程序)中使用了quartz,下面是quartz.property文件和quartz.job.xml的快照.

quartz.property

#===================================================
# Configure the Job Initialization Plugin
#===================================================

org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin
org.quartz.plugin.jobInitializer.fileNames = jobs.xml
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
org.quartz.plugin.jobInitializer.scanInterval = 10
org.quartz.plugin.jobInitializer.wrapInUserTransaction = false


<?xml version='1.0' encoding='utf-8'?>
<job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd"
  version="1.8">

    <schedule>
        <job>
            <name>my-very-clever-job</name>
            <group>MYJOB_GROUP</group>

            <description>The job description</description>
            <job-class>com.acme.scheduler.job.ReportJob</job-class>
        </job>

        <trigger>
            <cron>
                <name>my-trigger</name>
                <group>MYTRIGGER_GROUP</group>
                <job-name>my-very-clever-job</job-name>

                <job-group>MYJOB_GROUP</job-group>
                <!-- trigger every night at 4:30 am -->
                <cron-expression>0 30 4 * * ?</cron-expression>

            </cron>
        </trigger>
    </schedule>
</job-scheduling-data>
Run Code Online (Sandbox Code Playgroud)

按顺序,每件事都很好.我需要允许用户按照他们想要的方式更改时间(cron表达式).我的问题是如何动态设置cron表达式.

quartz-scheduler

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

Dagger2错误:组件取决于非分层作用域排序中的作用域组件

有人可以帮助我解决此问题吗,我正在尝试将dagger2添加到我的应用程序中以解决此范围问题。

Error:(14, 1) error: com.bmx.presentation.authentication.login.LoginComponent depends on scoped components in a non-hierarchical scope ordering:
@com.bmx.di.scope.ActivityScope com.bmx.data.remote.AuthenticationRepositoryComponent
@com.bmx.di.scope.ActivityScope com.bmx.presentation.authentication.login.LoginComponent


@Module
public class AppModule {
  private Application mApplication;
    public AppModule(Application mApplication) {
        this.mApplication = mApplication;
    }

    @Provides
    @Singleton
    Application provideApplication() {
        return mApplication;
    }

    @Provides
    @Singleton
    public Resources provideResources(Context context) {
        return context.getResources();
    }
}
---------------------------------
@Module
public class NetModule {
    String mBaseUrl;

    public NetModule(String mBaseUrl) {
        this.mBaseUrl = mBaseUrl;
    }
    @Provides
    @Singleton
    Cache provideHttpCache(Application application) {
        int cacheSize = 10 * …
Run Code Online (Sandbox Code Playgroud)

android dagger-2

5
推荐指数
0
解决办法
2217
查看次数

如何使用RxJava Observer而不是事件总线处理HTTP错误,例如401、403、503,500

我正在使用RetrofitOK-HTTPRxJava2处理网络调用,我在拦截器下面创建了用于处理每个网络调用的网络错误响应,是否有更好的方法来处理呢?EventBus是这种情况吗?

我不想在每种方法中检查此错误异常,

// HTTP客户端

         OkHttpClient tempClient = new OkHttpClient.Builder()
                            .readTimeout(CONNECT_TIMEOUT_IN_SEC, TimeUnit.SECONDS)// connect timeout
                            .connectTimeout(CONNECT_TIMEOUT_IN_SEC, TimeUnit.SECONDS)// socket timeout
                            .followRedirects(false)
                            .cache(provideHttpCache())
                            .addNetworkInterceptor(new ResponseCodeCheckInterceptor())
                            .addNetworkInterceptor(new ResponseCacheInterceptor())
                            .addInterceptor(new AddHeaderAndCookieInterceptor())
                            .build();
Run Code Online (Sandbox Code Playgroud)

HTTP客户端拦截器

      public class ResponseCodeCheckInterceptor implements Interceptor {
            private static final String TAG = "RespCacheInterceptor";

            @Override
            public Response intercept(Chain chain) throws IOException {
                Response response = chain.proceed(chain.request());
                Request originalRequest = chain.request();
                if (response.code() == HttpStatus.UNAUTHORIZED.value()) {
                      throw new UnAuthorizedException();
                }else if (response.code() == HttpStatus.INTERNAL_SERVER_ERROR.value()) {
                    throw new APIException(response.code(), "Server …
Run Code Online (Sandbox Code Playgroud)

mvp android retrofit retrofit2 rx-java2

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

如何更改UIKit UIImage:drawInRect方法到AppKIt NSImage:drawInRect方法

我正在将一个iphone应用程序移植到Mac应用程序,我必须将所有UIKit相关类更改为AppKit.如果你能帮助我,我真的很感激.这是下面最好的方法..

Iphone App - >使用UIKit

UIGraphicsPushContext(ctx);
[image drawInRect:rect];
UIGraphicsPopContext();
Run Code Online (Sandbox Code Playgroud)

Mac Os - 使用AppKit

[NSGraphicsContext saveGraphicsState];
NSGraphicsContext * nscg = [NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:YES];
[NSGraphicsContext setCurrentContext:nscg];
NSRect rect = NSMakeRect(offset.x * scale, offset.y * scale, scale * size.width, scale * size.height);
[NSGraphicsContext restoreGraphicsState];

[image drawInRect:rect fromRect:NSMakeRect( 0, 0, [image size].width, [image size].height )
        operation:NSCompositeClear
         fraction:1.0];
Run Code Online (Sandbox Code Playgroud)

cocoa

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

如何在底部显示标签栏,-Tab with Fragment

我正在开发基于选项卡的android应用程序,我已经看到"TabActivity"类已被弃用,而是使用Fragment来实现相同的功能,我使用以下链接开发我的应用程序,现在我需要显示标签栏中的底部,我尝试了几种方法,但无法使其正常工作,

http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/

有人可以帮我这个,我的标签布局xml

  <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            >

            <TabWidget
                android:id="@android:id/tabs"
                android:orientation="horizontal"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="0"
                />

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="0"/>

            <FrameLayout
                android:id="@+android:id/realtabcontent"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"/>
        </LinearLayout>
    </TabHost>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android android-layout

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

如何清除android中的活动堆栈

我的Android应用程序中有以下应用程序流程,

登录 - >主页 - > screen1-> screen2-> screen3-> screen4-> logout

在screen4中,我有一个注销按钮,允许用户从应用程序注销并重新登录.当我重新登录应用程序时,仍会显示以前的数据.当用户从应用程序注销时,有没有办法启动应用程序?

注意:以上所有活动的启动模式都设置为"单一任务",

问候,山姆.

android

3
推荐指数
1
解决办法
892
查看次数

UIBarButton作为后退按钮的风格

嗨我在导航栏上显示UIBarButton作为后退按钮,我怎么能有UIButton的默认后退按钮样式.

问候萨姆.

iphone

2
推荐指数
1
解决办法
6412
查看次数

如何在POI hssf中格式化列而不是单元格

打开包含成百上千行数据的excel文件时,我遇到了一个问题,“太多不同的单元格格式”

有关该错误的详细信息
http://excelzoom.com/2009/09/the-mystery-of-excels-too-many-different-cell-formats/

所以我试图格式化一列而不是一个单元格。我能弄清楚如何格式化列的唯一方法是格式化每个单独的单元格。通过实现下面列出的代码。我想格式化一列而不是一行。我有成百上千的数据行要格式化。任何建议将不胜感激。

谢谢,

HSSFCellStyle cellStyle = wb.createCellStyle();
HSSFDataFormat dataFormat = wb.createDataFormat();
cellStyle.setDataFormat(dataFormat.getFormat("0.00"));

HSSFRow row = sheet.createRow(iRow);
HSSFCell cell = row.createCell((short)1);
cell.setCellStyle(cellStyle);
Run Code Online (Sandbox Code Playgroud)

excel apache-poi

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