小编Ale*_*chs的帖子

显示ListView中的文件列表

我想知道如何从ListView中的目录显示文件.这些文件可以列出:

File dir = new File(dirPath);
File[] filelist = dir.listFiles();
Run Code Online (Sandbox Code Playgroud)

并添加到ListView通道ArrayAdapter但我没有得到的使用ArrayAdapter.

directory android file android-arrayadapter android-listview

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

Android PrintManager获得回调

我使用PrintManager打印网页,一旦打印成功,我的活动如何获得回调?我正在使用此代码:

    // Get a PrintManager instance
    PrintManager printManager = (PrintManager) this.getSystemService(Context.PRINT_SERVICE);

    // Get a print adapter instance
    PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter();

    // Create a print job with name and adapter instance
    String jobName = getString(R.string.app_name) + " Document";
    PrintJob printJob = printManager.print(jobName, printAdapter,
            new PrintAttributes.Builder().build());
    // Save the job object for later status checking
    //mPrintJobs.add(printJob);
Run Code Online (Sandbox Code Playgroud)

printing android

6
推荐指数
1
解决办法
2787
查看次数

使用PHP和PHPWord将HTML代码转换为doc

我正在使用PHPWord加载docx模板并替换标签{test}.这工作得非常好.

但我想用html代码替换值.不可能直接将其替换为模板.据我所知,现在有使用PHPWord的方法.

我看了htmltodocx.但它接缝它也无法工作,是否可以将代码的和平转换<p>Test<b>test</b><br>test</p>为工作的doc标记?我只需要基本代码,没有样式.但Linebreaks必须工作.

html php openxml phpword

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

PHPWord 损坏的文件?

我的基本 PHPWord 设置正在运行。

这是我的代码:

    <?php
  require_once 'PhpWord/Autoloader.php';
    \PhpOffice\PhpWord\Autoloader::register();



    function getEndingNotes($writers)
{
    $result = '';
    // Do not show execution time for index
    if (!IS_INDEX) {
        $result .= date('H:i:s') . " Done writing file(s)" . EOL;
        $result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL;
    }
    // Return
    if (CLI) {
        $result .= 'The results are stored in the "results" subdirectory.' . EOL;
    } else {
        if (!IS_INDEX) {
            $types …
Run Code Online (Sandbox Code Playgroud)

php ms-word docx openxml phpword

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

Android Intent Filter zip

我想使用Intent-filter,当在fileexplorer中单击一个zip文件时,它会打开应用程序

所以我必须使用哪种mimetype?以及获得路径的代码?

<activity
    android:name=".App"
    android:label="@string/app_name" >
    <intent-filter>
      <action android:name="android.intent.action.SEND" />

      <category android:name="android.intent.category.DEFAULT" />

      <data android:mimeType="text/plain" />

    </intent-filter>

    </activity>
Run Code Online (Sandbox Code Playgroud)

Java的代码:

Intent intent = getIntent();

        // To get the action of the intent use
        String action = intent.getAction();
        if (action != Intent.ACTION_SEND) {
            throw new RuntimeException("Should not happen");
        }
        // To get the data use
        Uri data = intent.getData();
        URL url;
        try {
            url = new URL(data.getPath());
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
Run Code Online (Sandbox Code Playgroud)

zip android intentfilter android-intent

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

Android减去日期

所以我试图减去我提出这个代码的2个日期:

java.text.DateFormat df = new java.text.SimpleDateFormat("hh:mm:ss_yyyy.MM.dd");
java.util.Date date1 = new java.util.Date();
java.util.Date date2 = df.parse("00:00:00_2013.01.01");
long diff = date2.getTime() - date1.getTime();
Run Code Online (Sandbox Code Playgroud)

但问题是差异不正确.

谁能告诉我我做错了什么?

android date subtraction simpledateformat

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

Android库zip

有人能告诉我是否有用于读取/写入与Android兼容的zip文件的Java库?

如果看看truezip但它似乎不起作用

java zip android

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