小编XxG*_*sxX的帖子

Android将图像复制到剪贴板/ clipdata

长按网络或其他地方的图像,我有机会将图像复制到设备的剪贴板中.看这里:

例

现在我想在我的应用程序中实现它.到目前为止我所拥有的:

Bitmap bitmap = getBitmap();
        File file = storeImage(bitmap, name);

        //Share
        Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("image/*");
        Uri uri = Uri.fromFile(file);
        shareIntent.putExtra(Intent.EXTRA_STREAM, uri);

        //Add Copy to Clipboard to choosers
        Intent clipboard = new Intent(this, CopyToClipboardImageActivity.class);
        clipboard.setData(uri);

        Intent chooserIntent = Intent.createChooser(shareIntent, getString(R.string.shareScreenshot));
        chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{clipboard});
        startActivity(chooserIntent);
Run Code Online (Sandbox Code Playgroud)

CopyToClipboardImageActivity

  public class CopyToClipboardImageActivity extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            Uri uri = getIntent().getData();
            if (uri != null) {
                copyImageToClipboard(uri);
                Toast.makeText(this, getString(R.string.hinweisInZwischenablageKopiert), Toast.LENGTH_SHORT).show();
            }

            // Finish right away. We …
Run Code Online (Sandbox Code Playgroud)

clipboard android jpeg copy image

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

Android Intent过滤器不显示我的应用

我在清单中添加了这个,以便用户能够使用我的应用程序打开xml文件.但是,当我点击一个xml文件并说"打开..."时,我的应用程序没有显示在列表中!我也删除并安装了新的应用程序!我测试的文件名是Test.xml

 <activity
       android:name=".activities.MainActivity"
       android:label="mainAcitivity"
       android:screenOrientation="portrait">

       <intent-filter>
         <action android:name="android.intent.action.VIEW" />
         <category android:name="android.intent.category.DEFAULT" />
         <data android:scheme="file"
            android:host="*"
            android:pathPattern=".*\\.xml"
            android:mimeType="*/*"  />
       </intent-filter>

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

android filter show android-intent

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

Android Manifest如何通过Flavor Activity替换Activity

如何使用manifest命令"replace"通过具有相同名称但在flavor包中的活动替换主包中的活动?

com.name.project/main/
-ActivityA
Run Code Online (Sandbox Code Playgroud)

替换为

com.name.project/pro/
-ActivityA
Run Code Online (Sandbox Code Playgroud)

merge android manifest android-productflavors

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

Android Beta应用宣称为"未发布"

我为我的Android应用程序创建了一个beta测试.问题是,如果你点击商店,它说(未发布)而不是(测试版).未释放是什么意思?我很困惑,因为它是你应该在appstore中找到的公共测试版.我只测试了用我的开发者帐户下载它.

组态: 组态

在Appstore中: 应用商店

beta android release developer-console

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

Android打开和关闭数据库

我在这里阅读了很多关于StackOverflow的讨论,还有很多关于互联网网站的讨论:我什么时候应该打开和关闭我的sqlite数据库.我已经阅读了不同时期的各种回应和猜测.所以最后我比以前更困惑.人们建议:

  1. 在onDestroy()中关闭你的数据库注释:"OnDestroy()总是不被调用!使用onStop()!" - >所以onStart()必须打开它.

  2. 数据库有效地工作.无需关闭它.

  3. 打开数据库一次,创建一个字段和一个访问者.

  4. 使用后关闭.

还有很多...

那么2016年什么是正确的呢?请不要猜!

Examplelinks:

Android:打开和关闭SQLite数据库

Android关闭数据库

database sqlite android android-sqlite

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

Android如何在发布之前获取Google Play商店链接

我想在几天内发布我的应用程序.在我的应用程序中,有一个速率按钮,用户应该链接到Google Play商店.是否有机会在发布应用程序之前添加此功能?或者我是否必须发布它并添加更新?

android release rate

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

Android Flavor Intent Activity

如何根据风味创建活动的意图?

等级制度:

main
-ActivityA

flavor(free)
-uses main/ActivityA

flavor(paid)
-uses own paid/ActivityA
Run Code Online (Sandbox Code Playgroud)

那么如何根据当前的风格创建一个 Intent 呢?

android android-intent android-activity android-productflavors

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

Android Proguard“找不到引用”

我想生成一个签名的apk。但我达到了 64k 方法的限制,所以我搜索了一些解决方案,其中之一是使用 proguard。我像这样编辑了 build.gradle:

 buildTypes {

        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

    }
Run Code Online (Sandbox Code Playgroud)

当我尝试生成签名的 apk 时,我收到很多警告:

Warning:com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$2: can't find referenced method 'android.widget.TextView access$000(com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar)' in program class com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar
Warning:com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar$2: can't find enclosing method 'void setTextProgressAlign()' in program class com.akexorcist.roundcornerprogressbar.TextRoundCornerProgressBar
Warning:com.github.mikephil.charting.data.realm.base.RealmBarLineScatterCandleBubbleDataSet: can't find referenced class io.realm.RealmResults
Warning:com.github.mikephil.charting.data.realm.base.RealmBarLineScatterCandleBubbleDataSet: can't find referenced class io.realm.RealmObject
Warning:com.github.mikephil.charting.data.realm.base.RealmBaseDataSet: can't find referenced class io.realm.Sort
Warning:com.github.mikephil.charting.data.realm.base.RealmBaseDataSet: can't find referenced class io.realm.RealmResults
Warning:com.github.mikephil.charting.data.realm.base.RealmBaseDataSet: can't find referenced class io.realm.Sort
Warning:com.github.mikephil.charting.data.realm.base.RealmBaseDataSet: can't find referenced class io.realm.RealmResults
Warning:com.github.mikephil.charting.data.realm.base.RealmBaseDataSet: …
Run Code Online (Sandbox Code Playgroud)

android signed proguard apk

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