小编Moh*_*Ali的帖子

如何使用方形毕加索库加载视频缩略图?

目前我正在使用picasso将MediaStore图像缩略图加载到ListView以下代码片段中:( video.getData()返回图像的实际路径,如mnt/sdcard/...)

Picasso.with(this.context)
       .load(new File(photo.getData()))
       .resize(50, 50).config(config)
       .centerCrop()
       .into(viewHolder.imageViewItem);
Run Code Online (Sandbox Code Playgroud)

现在我无法通过传递video.getData()而不是加载MediaStore视频缩略图photo.getData()

android picasso

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

读/写文件到内部/外部存储android时使用什么类和方法?

我有谷歌很多,阅读javadoc,加上搜索不同的论坛,包括这个阅读问题,但没有找到我的问题的正确答案.下面的代码片段工作正常,但我想知道在android中读取/写入文件的确切使用的函数.可以使用OutputStream,FileOutputSteam.write()写入内部存储,其他是使用OutputStreamWriter(FileOutputSteam).write(),进一步使用BufferedWriter(OutputStreamWriter).write(),最后使用PrintWriter.write().

对于InputStream情况,是否使用InputStream,FileInputSteam.read(),InputSreamReader(FileInputStream).read(),BufferedReader(InputStreamReader)也是如此.

我想知道哪种方法最合适.请帮助我完全与此混淆.

public class MainActivity extends Activity {

private static final String TAG = MainActivity.class.getName();
private static final String FILENAME = "students.txt";
private EditText stdId;
private Button Insert;
private Button Search;
private Button Update;
private Button Delete;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final String TAG = MainActivity.class.getName(); //output: com.fyp2.testapp.MainActivity

    //value used for insert/delete/search
    stdId = (EditText) findViewById(R.id.editTxtId);

    //insert value in application sandbox file
    Insert = (Button) findViewById(R.id.btnInsert);
    Insert.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            String …
Run Code Online (Sandbox Code Playgroud)

android

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

如何在路由执行前后修改slim v3响应体?

我无法在苗条的v3中得到反应体,它总是空白.我的代码是:

<?php

use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
use \Slim\App as Slim;

require 'vendor/autoload.php';

$config['determineRouteBeforeAppMiddleware'] = true;

$app = new Slim(['settings' => $config]);

$mw = (function (Request $request, Response $response, callable $next) {
    $response = $response->withStatus(200)->write(' before ');
    $response = $next($request, $response);
    $body = $response->getBody()->getContents();
    $response = $response->withJson(array('data' => $body)); // output should be {"data":" Hello, User  seq1  seq2 "}
    return $response;
});

$mw1 = (function (Request $request, Response $response, callable $next) {
    $response = $next($request, $response);
    $response …
Run Code Online (Sandbox Code Playgroud)

php slim

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

标签 统计

android ×2

php ×1

picasso ×1

slim ×1