小编M.Y*_*ran的帖子

java.lang.IllegalStateException:回复已提交 - 当尝试多次调用 result.success 时?

当我尝试从 android 本机多次传递值到 flutter 时,出现以下异常。

\n
E/AndroidRuntime(14203): java.lang.IllegalStateException: Reply already submitted\nE/AndroidRuntime(14203): at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:162)\nE/AndroidRuntime(14203): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:194)\nE/AndroidRuntime(14203): at com.dooboolab.flutterinapppurchase.FlutterInappPurchasePlugin$2.onBillingSetupFinished(FlutterInappPurchasePlugin.java:94)\nE/AndroidRuntime(14203): at com.android.billingclient.api.BillingClientImpl$BillingServiceConnection.onServiceConnected(BillingClientImpl.java:903)\nE/AndroidRuntime(14203): at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1386)\nE/AndroidRuntime(14203): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1403)\nE/AndroidRuntime(14203): at android.os.Handler.handleCallback(Handler.java:739)\nE/AndroidRuntime(14203): at android.os.Handler.dispatchMessage(Handler.java:95)\nE/AndroidRuntime(14203): at android.os.Looper.loop(Looper.java:135)\nE/AndroidRuntime(14203): at android.app.ActivityThread.main(ActivityThread.java:5422)\nE/AndroidRuntime(14203): at java.lang.reflect.Method.invoke(Native Method)\nE/AndroidRuntime(14203): at java.lang.reflect.Method.invoke(Method.java:372)\nE/AndroidRuntime(14203): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)\nE/AndroidRuntime(14203): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)\n
Run Code Online (Sandbox Code Playgroud)\n

我的颤振版本:

\n
[\xe2\x9c\x93] Flutter (Channel stable, 1.22.5, on Mac OS X 10.14.6 18G6032 darwin-x64, locale en-IN)\n
Run Code Online (Sandbox Code Playgroud)\n

我的问题是如何从 android 原生调用 result.success 到 flutter?

\n

android flutter

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

如何从Android中的FCM数据消息中获取价值?

我正在尝试在我的应用中实施FCM通知.我已阅读FCM数据消息类型即使在应用程序处于后台时也会收到通知,所以我试图在onMessageRecieved方法中实现这样的意外响应,如下所示:

{title =2, message={"Status":"UNASSIGNED","CompanyName":"gd","LastModifiedDateTime":"2017-04-25 18:59:41","IsPartRequired":false,"ProblemCategory":"CONFIGURATION","IsGeneralClaim":false,"RegistrationID":1057,"IncidentCode":"INS\/2017\/04\/25-0010","StatusID":0,"CreatedDateTime":"2017-04-25 18:59:41","IsInstallationCall":false}}
Run Code Online (Sandbox Code Playgroud)

不知道如何解析这个从标题和消息中获取单独的值让我发布我的firebase消息代码:

public class FireBaseMessage extends FirebaseMessagingService {
    private static final String TAG = "MyFirebaseMsgService";

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);
      Map<String,String> data = remoteMessage.getData();
        Log.d(TAG, "From: " + data.toString());
// 
}
}
Run Code Online (Sandbox Code Playgroud)

在这条日志消息中我得到的反应是如何从中获取价值的尝试如下:

int title=data.get("title"); 
Run Code Online (Sandbox Code Playgroud)

获取空指针,因为它不是有效格式.在我的服务器端,我试图发布像这样的json格式:

{
   "to":"es_OToDkj00:APA91bFqxbVMAaXy5fPtDbNVAkIwyVrPCmfGci2otHZPvdRoXPv-oDdjgtLR92Nqe8w6f57nCVceLbc3_zBWsInG9g1Pfdp3LvsMKyuaiYps0L1y3tn0N0XbzGseEI6jyiqs1r-sT9lb",
   "data":{
      "message":{
         "RegistrationID":1057,
         "IncidentCode":"INS/2017/04/25-0010",
         "CompanyName":"ABM INFOTECH",
         "StatusID":5,
         "Status":"ASSIGNED",
         "CreatedDateTime":"2017-04-25T12:03:45",
         "LastModifiedDateTime":"2017-04-25T18:59:41",
         "ProblemCategory":"CONFIGURATION",
         "IsPartRequired":false,
         "IsInstallationCall":false,
         "IsGeneralClaim":false
      },
      "title ":"1"
   }
Run Code Online (Sandbox Code Playgroud)

不知道我在哪里弄错了.谁能帮我?提前致谢!

android firebase firebase-cloud-messaging

5
推荐指数
2
解决办法
8553
查看次数

如何在 Google Drive Android 中备份房间数据库?

这可能是一个愚蠢的问题,但我找不到任何解决方案。我需要知道如何备份 roomdatabase 并使用 Google Drive 检索它。那么房间数据库的mime类型是什么?谁能知道如何做到这一点?让我发布我迄今为止尝试过的内容:

 private void saveFileToDrive(File file) {

        mDriveClient = Drive.getDriveClient(this, GoogleSignIn.getLastSignedInAccount(this));
        // Build a drive resource client.
        mDriveResourceClient =
                Drive.getDriveResourceClient(this, GoogleSignIn.getLastSignedInAccount(this));

        final Task<DriveFolder> rootFolderTask =mDriveResourceClient.getRootFolder();
        final Task<DriveContents> createContentsTask =mDriveResourceClient.createContents();
        Tasks.whenAll(rootFolderTask, createContentsTask)
                .continueWithTask(new Continuation<Void, Task<DriveFile>>() {
                    @Override
                    public Task<DriveFile> then(@NonNull Task<Void> task) throws Exception {
                        DriveFolder parent = rootFolderTask.getResult();
                        DriveContents contents = createContentsTask.getResult();
//                        OutputStream outputStream = contents.getOutputStream();
//                        try (Writer writer = new OutputStreamWriter(outputStream)) {
//                            writer.write("Hello World!");
//                        }
                        OutputStream oos = contents.getOutputStream();
                        if (oos …
Run Code Online (Sandbox Code Playgroud)

android google-drive-android-api android-room

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

使用翻新功能动态填充微调器?

在这里寻找的是需要填充spinner,这是rest服务使用Retrofit的json响应。经过长期的研究,我找不到任何样本,可以根据这个共享任何样本,这对我非常有用,谢谢!

android android-spinner retrofit

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

如何在android中滚动时固定工具栏?

在发布此问题之前,我已经研究了之前的所有问题.之前的解决方案都没有为我工作.我需要制作我的Toolbar静态,同时滚动它在滚动时上升但我需要使它静态我怎么能这样做.现在让我解释一下到目前为止我尝试过的所有方法,

  1. 我已进入windowSoftInputMode调整大小调整

  2. fitwindows 布局中的确实

这是我写的代码:

这是主要的CoordinatorLayout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:layout_scrollFlags="scroll|enterAlways" />
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/activity_incident"
       />



</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

这是布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_incident"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">
    <android.support.v7.widget.RecyclerView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/incident_recyclerview"
        android:divider="#fff"
         android:keepScreenOn="true"
        android:dividerHeight="0.5dp"
        />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我只是想让我的Toolbar静态我怎么能实现提前谢谢!!

android toolbar android-scroll material-design

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

如何在谷歌地图自定义标记中的圆形图像周围产生涟漪?

这可能是一个愚蠢的问题,但我找不到任何解决方案,以前关于这个问题的答案现在让我发布我的问题,我需要在谷歌地图标记中的圆形图像周围产生涟漪效应,现在让我发布我迄今为止尝试过的内容:

  @Override
    public void onLocationChanged(final Location location) {
        mLastLocation=location;
        GradientDrawable d = new GradientDrawable();
        d.setShape(GradientDrawable.OVAL);
        d.setSize(500,500);
        d.setColor(0x555751FF);
        d.setStroke(5, Color.TRANSPARENT);

        Bitmap bitmap = Bitmap.createBitmap(d.getIntrinsicWidth()
                , d.getIntrinsicHeight()
                , Bitmap.Config.ARGB_8888);
        final Canvas canvas = new Canvas(bitmap);
        d.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        d.draw(canvas);
        final int radius = 100;
        final GroundOverlay circle = mMap.addGroundOverlay(new GroundOverlayOptions()
                .position(new LatLng(location.getLatitude(),location.getLongitude()), 2 * radius).image(BitmapDescriptorFactory.fromBitmap(createMarker(TrackingActivity.this,new LatLng(location.getLatitude(),location.getLongitude())))));
        ValueAnimator valueAnimator = new ValueAnimator();
        valueAnimator.setRepeatCount(ValueAnimator.INFINITE);
        valueAnimator.setRepeatMode(ValueAnimator.RESTART);
        valueAnimator.setIntValues(0, radius);
        valueAnimator.setDuration(3000);
        valueAnimator.setEvaluator(new IntEvaluator());
        valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                float animatedFraction …
Run Code Online (Sandbox Code Playgroud)

android google-maps marker

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