小编Ame*_*eer的帖子

从我的Android应用程序以编程方式打开所选文件(图像,pdf,...)?

我正在开发一个Android应用程序,该应用程序应该能够从特定文件夹中打开所选文件.

我已经尝试了这个,但在选择了我要打开它的应用程序后,我得到了这样的消息:

不可能加载

在尝试了很多线程1线程2之后,我使用这些代码行来完成它:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("/mnt/sdcard/xxx/xxx/Pictures/xxx.jpg"), "image/*");
myContext.startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

我怎么能搞清楚这一点?

pdf android image android-intent

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

将数据库文件复制到android中的sdcard

我通过此代码获取我的数据库文件

  File dbFile=getDatabasePath("EdsysEyfsDB.db");
               Log.v("database name checking", dbFile.toString());
Run Code Online (Sandbox Code Playgroud)

我想将此数据库文件复制到SD卡,以便我可以为此做一些操作.但我不能做任何操作.以下代码用于复制到SD卡

         if (dbFile.exists()) {
                       InputStream inStream = new FileInputStream(dbFile);
                       String file = Environment.getExternalStorageDirectory().getPath()
                            +"/" + "database.db";
                       Log.d("file name checking in  dbFilecondition", file);
                       FileOutputStream fs = new FileOutputStream(file);
                       byte[] buffer = new byte[1444];
                       while ((byteread = inStream.read(buffer)) != -1) {
                           bytesum += byteread;
                           fs.write(buffer, 0, byteread);
                       }
                       inStream.close();
                       fs.close();
                   }
Run Code Online (Sandbox Code Playgroud)

但我不会处于这种情况.数据库文件名在LogCat上正常运行.我已经允许读写文件.

database android file

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

gradle kts 文件中的 applyNativeModulesAppBuildGradle(project) 和 applyNativeModulesSettingsGradle

我正在使用 Gradle KTS 文件并尝试设置 React Native。我无法添加

应用NativeModulesAppBuildGradle(项目)

applyNativeModulesAppBuildGradleKTS有什么替代方案吗?另外在设置上,我们必须写applyNativeModulesSettingsGradle

android kotlin react-native gradle-kotlin-dsl

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

类型库已弃用

imageView.setLayoutParams(new Gallery.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT));
Run Code Online (Sandbox Code Playgroud)

替换Gallery的其他方法有哪些?所以我可以在活动中使用水平滚动

android

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

缩放textview在android中有图像和文本(Html内容)

我有一个textview,其中包含图像和文本的html内容.我必须缩放textview.我知道如何缩放textview中的文本.但是图像不会被缩放.

textview.setText(Html.fromHtml("text",
            new ImageGetter(), null));

private class ImageGetter implements Html.ImageGetter {

    public Drawable getDrawable(String source) {
        LevelListDrawable d = new LevelListDrawable();
        Drawable empty = getResources().getDrawable(R.drawable.ic_launcher);
        d.addLevel(0, 0, empty);
        d.setBounds(0, 0, empty.getIntrinsicWidth(),
                empty.getIntrinsicHeight());

        new LoadImage().execute(source, d);

        return d;
    }
};

    public boolean onTouchEvent(MotionEvent event) {
    if (event.getPointerCount() == 2) {
        int action = event.getAction();
        int pureaction = action & MotionEvent.ACTION_MASK;
        if (pureaction == MotionEvent.ACTION_POINTER_DOWN) {
            mBaseDist = getDistance(event);
            mBaseRatio = mRatio;
        } else {
            float delta = (getDistance(event) - mBaseDist) / …
Run Code Online (Sandbox Code Playgroud)

android zoom textview

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

在v26中不推荐使用PercentRelativeLayout

我想显示一个有6个视图的布局,我按宽度和高度百分比设置.但PercentageLayout在Android v26中已弃用.有什么替代方案PercentageLayout.Android文档是说使用ConstraintLayoutapp:layout_constraintGuide_percent.(https://developer.android.com/reference/android/support/percent/PercentRelativeLayout.html)但是PercentageLayout我们可以使用

 app:layout_heightPercent="33.4%"
    app:layout_widthPercent="45%"
Run Code Online (Sandbox Code Playgroud)

android android-layout android-support-library android-constraintlayout

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