Can't get the location in intend while I can get the text. Why?

-1

In the below code, I can't get the intend value of latitude, longitude and altitude, but I get the text value name and detail. I don't know why this is happening like that. Below is my adapter intend class...

package com.onebook.locationsaver;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


import static android.content.ContentValues.TAG;
import static androidx.core.content.ContextCompat.startActivity;


public class SaveListAdapter extends androidx.recyclerview.widget.RecyclerView.Adapter<SaveListAdapter.ViewHolder>  {
    private Context context;
    private List<DatabseMode> databasemodelist;
    private ArrayList<DatabseMode> newlist = new ArrayList<>();

    public SaveListAdapter(Context context, List<DatabseMode> databasemodelist) {
        this.databasemodelist=databasemodelist;
        this.context = context;
        for (int i = databasemodelist.size() - 1; i >= 0; i--) {
            newlist.add(databasemodelist.get(i));
        }
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new SaveListAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.recycle_view_icon, parent, false));
    }


    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
        final DatabseMode databseMode = newlist.get(position);
        holder.name.setText(databseMode.getname());
        holder.detail.setText(databseMode.getdetail());

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context,"Item is selected",Toast.LENGTH_LONG).show();
                DatabseMode databseMode = newlist.get(position);

                Intent intent=new Intent(context.getApplicationContext(),Edit.class);
                intent.putExtra("id",databseMode.getid());
                intent.putExtra("latitude",databseMode.getlatitude());
                intent.putExtra("longitude",databseMode.getlongitude());
                intent.putExtra("altitude",databseMode.getaltitude());
                intent.putExtra("name",databseMode.getname());
                intent.putExtra("detail",databseMode.getdetail());

                context.startActivity(intent);
            }
        });
    }

    @Override
    public int getItemCount() {
        return databasemodelist.size();
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        public TextView name;
        public TextView detail;

        public ViewHolder(View itemView) {
            super(itemView);
            name =  itemView.findViewById(R.id.textView);
            detail = itemView.findViewById(R.id.textview00);
        }
    }}

By Intend I send details but I can't get the latitude and longitude and altitude only but I can get the text name and detail why?

    package com.onebook.locationsaver;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;

public class Edit extends Activity {


    private TextView msavelatitude,msavelongitude,msavealtitude;
    private EditText name,detail;
    private ImageButton save,back;
    private Button btn;
    private DatabaseHelper databaseHelper;
    Context context;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.edit);

        msavelatitude=findViewById(R.id.meditlatitude);
        msavelongitude=findViewById(R.id.meditlongitude);
        msavealtitude=findViewById(R.id.meditaltitude);
        save=findViewById(R.id.meditsave);
        back=findViewById(R.id.meditcrossss);
        name=findViewById(R.id.meditname);
        detail=findViewById(R.id.meditdetail);
        btn=findViewById(R.id.meditblank);

        databaseHelper=new DatabaseHelper(this);
        Intent intend = getIntent();
        Bundle bundle=intend.getExtras();
        String latitude= (String) bundle.get("latitude");
        String longitude= (String) bundle.get("longitude");
        String altitude= (String) bundle.get("altitude");

        String mname=bundle.getString("name");
        String mdetail=bundle.getString("detail");



            msavelatitude.setText((String) bundle.get("latitude"));

       msavelongitude.setText((String) bundle.get("longitude"));
        msavealtitude.setText((String) bundle.get("altitude"));
        name.setText(mname);
        detail.setText(mdetail);



    }
}

then my logcat error is like this some type of "failed to get memory consumption info: -1 " and " memtrack module"

This is my logcat image

new selection locat

The logcats

12-21 13:01:29.273 10376-10376/? I/art: Late-enabling -Xcheck:jni
12-21 13:01:29.320 10376-10376/? D/TidaProvider: TidaProvider()
12-21 13:01:29.331 10376-10376/? W/ReflectionUtils: java.lang.NoSuchMethodException: android.os.MessageQueue#enableMonitor()#bestmatch
        at miui.util.ReflectionUtils.findMethodBestMatch(ReflectionUtils.java:338)
        at miui.util.ReflectionUtils.findMethodBestMatch(ReflectionUtils.java:375)
        at miui.util.ReflectionUtils.callMethod(ReflectionUtils.java:800)
        at miui.util.ReflectionUtils.tryCallMethod(ReflectionUtils.java:818)
        at android.os.BaseLooper.enableMonitor(BaseLooper.java:47)
        at android.os.Looper.prepareMainLooper(Looper.java:111)
        at android.app.ActivityThread.main(ActivityThread.java:5586)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
12-21 13:01:29.401 10376-10376/com.onebook.locationsaver W/ResourceType: No package identifier when getting name for resource number 0x00000000
12-21 13:01:29.412 10376-10376/com.onebook.locationsaver W/System: ClassLoader referenced unknown path: /data/app/com.onebook.locationsaver-2/lib/arm64
12-21 13:01:29.472 10376-10376/com.onebook.locationsaver W/ResourceType: No package identifier when getting name for resource number 0x00000000
12-21 13:01:29.490 10376-10376/com.onebook.locationsaver W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-21 13:01:29.532 10376-10376/com.onebook.locationsaver D/AccessibilityManager: current package=com.onebook.locationsaver, accessibility manager mIsFinalEnabled=false, mOptimizeEnabled=false, mIsUiAutomationEnabled=false, mIsInterestedPackage=false
12-21 13:01:29.553 10376-10376/com.onebook.locationsaver I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
12-21 13:01:29.554 10376-10376/com.onebook.locationsaver I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
12-21 13:01:29.631 10376-10376/com.onebook.locationsaver D/Network: Network
12-21 13:01:29.681 10376-10400/com.onebook.locationsaver D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-21 13:01:29.955 10376-10400/com.onebook.locationsaver I/Adreno: QUALCOMM build                   : a7823f5, I59a6815413
    Build Date                       : 09/23/16
    OpenGL ES Shader Compiler Version: XE031.07.00.00
    Local Branch                     : mybranch22028469
    Remote Branch                    : quic/LA.BR.1.3.3_rb2.26
    Remote Branch                    : NONE
    Reconstruct Branch               : NOTHING
12-21 13:01:29.978 10376-10400/com.onebook.locationsaver I/OpenGLRenderer: Initialized EGL, version 1.4
12-21 13:01:29.995 10376-10400/com.onebook.locationsaver E/HAL: hw_get_module_by_class: module name gralloc
12-21 13:01:29.995 10376-10400/com.onebook.locationsaver E/HAL: hw_get_module_by_class: module name gralloc
java
android
android-fragments
android-recyclerview
asked on Stack Overflow Dec 21, 2019 by charles leo • edited Dec 21, 2019 by charles leo

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0