小编har*_*ore的帖子

用AES加密/解密

在Android 上如何加密/解密 __CODE__和其他文件有一个很好的例子__CODE__吗?我正在开发一个需要加密/解密数据的项目,但我不确定该怎么做.

java encryption android aes

101
推荐指数
7
解决办法
17万
查看次数

为什么FrameLayout用于片段?

无论我在哪里,FrameLayout似乎都被用作FragmentContainer.为什么FrameLayout总能看到Fragments

java android fragment android-framelayout

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

如何清除缓存Android

我需要找到一种方法如何清除我的应用程序存储在缓存中的数据.基本上我使用Fedor(在ListView中的图像延迟加载)惰性列表实现,我想在我加载例如100个图像时自动清除缓存.任何想法怎么做?

编辑: 代码:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    list=(ListView)findViewById(R.id.list);
    adapter=new LazyAdapter(this, mStrings);
    list.setAdapter(adapter);

    deleteCache(this);
    adapter.notifyDataSetChanged();


}

public static void deleteCache(Context context) {
    try {
        File dir = context.getCacheDir();
        if (dir != null && dir.isDirectory()) {
            deleteDir(dir);
        }
    } catch (Exception e) {}
}

public static boolean deleteDir(File dir) {
    if (dir != null && dir.isDirectory()) {
        String[] children = dir.list();
        for (int i = 0; i < children.length; i++) {
            boolean success = deleteDir(new …
Run Code Online (Sandbox Code Playgroud)

android caching list lazy-evaluation clear

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

获取Bitmap Android的大小

可能重复:
解码后的位图字节大小?

反正所以我可以得到这个Bitmap的大小?我试过使用getByteCount()但我不能使用它?

Bitmap bitmap = BitmapFactory.decodeByteArray(decryptedData , 0, decryptedData .length);    //decoding bytearrayoutputstream to bitmap
Run Code Online (Sandbox Code Playgroud)

有什么建议?

size android get bitmap bitmapfactory

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

发布Json对象数据以使用android中的volley获取Json数组响应

我需要发布JSONObject(使用Volley)一个以JSONArray格式返回响应的Web服务.

这是我到目前为止所尝试的.

final JSONObject requestJsonObject = new JSONObject();
requestJsonObject.put("username", userName);
requestJsonObject.put("password", password);

JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.POST, ServiceUrls.LOGIN_URL, requestJsonObject, loginResponseListener, loginErrorListener);


private Listener<JSONObject> loginResponseListener = new Listener<JSONObject>() {
    @Override
    public void onResponse(JSONObject resposne) {
         //other stuff goes here
    }
};
Run Code Online (Sandbox Code Playgroud)

但我JSONException要说的是JSONArray无法转换为JSONObject.有没有办法以JSONArray格式获得响应?什么是我的问题的最佳解决方案?JSONObject如果我使用StringRequest而不是,我该如何发送JsonObjectRequest?请指导我

android json http-post android-volley jsonobject

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

适用于Android 2.1的操作栏

是否有Android Level 7或其他可以用作操作栏的操作栏?我需要构建一个使用Android 2.1操作栏的应用程序

user-interface android

7
推荐指数
2
解决办法
8255
查看次数

Android Lint插件 - 设置应该检查的自定义警告/错误

我的问题是,如果有一种方法可以在构建版本之前向lint插件添加一个自定义检查,它应该警告我.例如,我希望它检查Cursor, InputStream我的代码中的所有对象,如果它们被关闭,或者检查我的代码//TODO:,//FIXME:.

任何想法,如果有任何方式,甚至没有Lint插件?

提前致谢!

android lint

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

Android IME接受unicode

在为android编写输入法编辑器时,为了使其映射,我需要做什么才能接受一些unicode字符作为输入而不是更改android:keyLabel(例如让我将马拉雅拉姆语字符映射为输入:0D00 - 0DFF)

  <Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
        android:horizontalGap="0px"
        android:keyHeight="@dimen/key_height"
        android:keyWidth="10%p"
        android:verticalGap="0px" >

        <Row>
            <Key
                android:codes="45"
                android:keyEdgeFlags="left"
                android:keyLabel="q"
                android:popupCharacters="@string/hello"
                android:popupKeyboard="@xml/qwerty"/>
            <Key
                android:codes="51"
                android:keyLabel="w" />
            <Key
                android:codes="33"
                android:keyLabel="e" />
            <Key
                android:codes="46"
                android:keyLabel="r" />
            <Key
                android:codes="48"
                android:keyLabel="t" />
            <Key
                android:codes="53"
                android:keyLabel="y" />
            <Key
                android:codes="49"
                android:keyLabel="u" />
            <Key
                android:codes="37"
                android:keyLabel="i" />
            <Key
                android:codes="43"
                android:keyLabel="o" />
            <Key
                android:codes="44"
                android:keyEdgeFlags="right"
                android:keyLabel="p" />
        </Row>
        <Row>
            <Key
                android:codes="29"
                android:horizontalGap="5%p"
                android:keyEdgeFlags="left"
                android:keyLabel="a" />
            <Key
                android:codes="47"
                android:keyLabel="s" />
            <Key
                android:codes="32"
                android:keyLabel="d" />
            <Key
                android:codes="34"
                android:keyLabel="f" />
            <Key
                android:codes="35"
                android:keyLabel="g" />
            <Key
                android:codes="36" …
Run Code Online (Sandbox Code Playgroud)

keyboard unicode android ime

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

如何在Android中提高效率?

我有这段代码CameraPreview从a 获取a的位图TextureView并将其呈现在a上ImageView.

public void onSurfaceTextureUpdated(SurfaceTexture surface) {
    // Invoked every time there's a new Camera preview frame

    bmp = mTextureView.getBitmap();
    bmp2 = bmp.copy(bmp.getConfig(),true);

    for(int x=0;x<bmp.getWidth();x++){
        for(int y=0;y<bmp.getHeight();y++){
            //Log.i("Pixel RGB (Int)", Integer.toString(bmp.getPixel(x,y)));
            if(bmp.getPixel(x,y) < -8388608){
                bmp2.setPixel(x,y,Color.WHITE);
            }else{
                bmp2.setPixel(x,y,Color.BLACK);
            }
        }
    }

    mImageView.setImageBitmap(bmp2);
}
Run Code Online (Sandbox Code Playgroud)

所以基本上我将在相机显示的任何内容上应用实时图像处理.现在它只是背面和白色像素.它现在有点慢,位图的宽度和高度只有~250像素.

这是推荐的做法吗?

android

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

Android Gradle构建版本EXCEPTION FROM SIMULATION错误

在我的项目中,我决定包含Appsee Library,但是一旦我这样做,我就会Exception From Simulation在尝试运行gradle assembleRelease并构建应用程序的发布版本时开始收到错误.这是错误日志:

Error:Execution failed for task ':startActivity:dexRelease'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Users/hardartcore/Library/Android/sdk/build-tools/21.1.2/dx -JXmx4g --dex --output /Users/hardartcore/Desktop/sworkspace/Work/startActivity/build/intermediates/dex/release --input-list=/Users/hardartcore/Desktop/sworkspace/Work/startActivity/build/intermediates/tmp/dex/release/inputList.txt
  Error Code:
    1
  Output:
    EXCEPTION FROM SIMULATION:
    expected type int but found cfz
    ...at bytecode offset 0000000d
    ...while working on block 000d
    ...while working on method <clinit>:()V
    ...while processing <clinit> ()V
    ...while processing cfz.class
    1 error; aborting
Run Code Online (Sandbox Code Playgroud)

我在谷歌做了一些研究,但没有看到任何关于这种错误的解释以及为什么会发生这种情况.如果我删除AppSeejar库一切正常,我可以构建我的应用程序.

我的build.gradle文件:

buildscript {
    repositories {
        maven { url 'http://download.crashlytics.com/maven' }
    } …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin

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