小编roo*_*per的帖子

对于org/intellij/lang/annotations/Identifier.class的TransformException重复条目

我收到了这个错误

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: 
duplicate entry: org/intellij/lang/annotations/Identifier.class
Run Code Online (Sandbox Code Playgroud)

它是在我加入compile "com.wefika:flowlayout:0.4.0"我的gradle 之后开始的

这是我的gradle文件

 packagingOptions {
    exclude 'META-INF/NOTICE' // will not include NOTICE file
    exclude 'META-INF/LICENSE' // will not include LICENSE file
    // as noted by @Vishnuvathsan you may also need to include
    // variations on the file name. It depends on your dependencies.
    // Some other common variations on notice and license file names
    exclude 'META-INF/notice'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license'
    exclude 'META-INF/license.txt'
}

dexOptions { …
Run Code Online (Sandbox Code Playgroud)

android intellij-idea

12
推荐指数
2
解决办法
3998
查看次数

ClassCastException:android.support.v7.widget.LinearLayoutCompat $ LayoutParams无法强制转换为android.widget.LinearLayout $ LayoutParams

我已经创建了一个带有自定义布局的警告对话框,它工作正常但是当我尝试将单个选项设置为alertDialogBu​​ilder时它会ClassCastException: android.support.v7.widget.LinearLayoutCompat$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams出错

    View viewDialog = LayoutInflater.from(this).inflate(R.layout.dialog_verify, null,false);

    alertDialogBuilder.setView(viewDialog);

    final TextView tvDialogTitle = (TextView) viewDialog.findViewById(R.id.dialog_textview_title);

    final Button btnCancel = (Button) viewDialog.findViewById(R.id.dialog_btn_cancel);
    final Button btnVerify = (Button) viewDialog.findViewById(R.id.dialog_btn_verify);
    btnCancel.setVisibility(View.GONE);
    btnVerify.setText("cancel");
    btnVerify.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));
    btnVerify.setBackgroundResource(R.drawable.round_white);


    //set single layout structure
    alertDialogBuilder.setSingleChoiceItems(arrayReportType, selectedIndex, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            selectedIndex=which;
            tvReportStatus.setText(arrayReportType[selectedIndex]);
            dialog.dismiss();
        }
    });
    alertDialogBuilder.setCancelable(true);
    Typeface font_bold = Typeface.createFromAsset(getAssets(), Constants.FONT_BOLD);
    tvDialogTitle.setTypeface(font_bold);
    tvDialogTitle.setText("Summary");
    final AlertDialog alertDialog = alertDialogBuilder.create();
    alertDialog.show();
Run Code Online (Sandbox Code Playgroud)

更新:XML文件,我正在通过它来提升警报对话框

    <TextView
        android:id="@+id/dialog_textview_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="20sp" …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-alertdialog

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

使用sqlite的离线聊天存储

我使用 firebase 创建了一个聊天应用程序,我想将聊天数据存储在用户设备中,并在互联网不可用时向用户显示。我在如何实现它之间左右为难我想使用领域,但它使应用程序大小几乎增加了 6mb(我的应用程序大小为 4mb),所以我切换回 SQLite。

现在我想知道最好的做法是什么,所以我已经实施了几个仍然不清楚如何做的流程。

我已经创建了一个master_chat表,其中我有message_idtofromthread_id与次级chat_data其中I使用的表message_id作为参考来master_chat表和插入messageBodytoEmailfromEmailtimemessageTypefileSizedownloadLink

现在的问题是我是否应该遵循这种方法,以便每次用户输入消息时,它都会被添加到chat_data或直接存储arrayList并在每次发送或接收消息时更新它。

任何指导都会很棒!

sqlite android

5
推荐指数
0
解决办法
628
查看次数

在添加值事件侦听器中多次调用数据更改上的firebase

我设置了两个听众

  1. 查询以获取最后一条消息
  2. 如果最后一条消息是组类型,我将使用组Listener获取组信息

但是,当我使用messageListener从消息中获取类型并设置groupListener时,它返回多个onDataChange, Debug.e("parentsnap",dataSnapshot.getValue().toString());被调用多次,我应该怎么做,请指导

    groupListener = new ValueEventListener() {
        @SuppressWarnings("unchecked")
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            Debug.e("parent snap", dataSnapshot.getValue().toString());
            for (DataSnapshot d :
                    dataSnapshot.getChildren()) {
           //my code
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    };
    groups.child(chatId).addValueEventListener(groupListener);
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-realtime-database

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

禁用 alertDialog 中的复选框项目

我让数组通过警报对话框选择多个选项 如果数组已满,我想禁用选择

我已经能够在达到限制后停止向数组添加项目,但无法禁用复选框

 AlertDialog.Builder builder=new AlertDialog.Builder(this);
 View view=inflater.inflate(R.layout.dialog_genre,null,false);
 builder.setView(view).setTitle("Select Genres");

 builder.setMultiChoiceItems(array, checkedGenres, new DialogInterface.OnMultiChoiceClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which, boolean isChecked) {
            if(isChecked) {
                if (!selectedgenre.contains(String.valueOf(which)))
                    if(selectedgenre.size()<5)
                {
                    selectedgenre.add(String.valueOf(which));
                    checkedGenres[which]=true;
                }
                else{
                        Toast.makeText(getApplicationContext(),"you can't add more genres",Toast.LENGTH_LONG).show();
                    }
            }
            else if (selectedgenre.contains(String.valueOf(which)))
            {
             selectedgenre.remove(String.valueOf(which));
             checkedGenres[which]=false;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

android android-alertdialog

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

点击Marker获取经度和纬度

我正在lat/lng: (19.1972,72.93)使用我的字符串

String position=String.valueOf(marker.getPosition());

如何只得到纬度和经度,我不想使用拆分

提前致谢!

android google-maps

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