android studio评论发布页面不工作

xxe27gdn  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(137)

我想在我在androidstudio上做的项目中做一个类似instagram的评论页面。注解片段即将出现,但当我编写注解并发送它时,它将停止。注解部分不会出现在firebase中。我希望在我的项目上发布注解,然后查看这些注解。运行部分表示如下。我已经找过了,但找不到
androidmanifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.geziproject">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Geziproject">
        <activity android:name=".AnasayfaActivity"
            android:theme="@style/Theme.Geziproject.NoActionBar">
        </activity>
        <activity android:name=".MainActivity2" />
        <activity android:name=".LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main">
        </activity>
        <activity android:name=".bos" />
        <activity android:name=".kayitol" />
        <activity android:name=".kullanicigiris" />
    </application>

</manifest>

日志:

Run:

Exception thrown while unbinding
    java.lang.IllegalArgumentException: Service not registered: lu@1581393
        at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1870)
        at android.app.ContextImpl.unbindService(ContextImpl.java:1847)
        at android.content.ContextWrapper.unbindService(ContextWrapper.java:755)
        at ci.f(:com.google.android.gms.dynamite_measurementdynamite@204516081@20.45.16 (120400-0):1)
        at ci.d(:com.google.android.gms.dynamite_measurementdynamite@204516081@20.45.16 (120400-0):2)
        at lv.E(:com.google.android.gms.dynamite_measurementdynamite@204516081@20.45.16 (120400-0):9)
        at lf.a(:com.google.android.gms.dynamite_measurementdynamite@204516081@20.45.16 (120400-0):3)
        at ef.run(:com.google.android.gms.dynamite_measurementdynamite@204516081@20.45.16 (120400-0):3)

fragment_yorumyaz.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Yorumyaz1Fragment">
    <androidx.appcompat.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/toolbar_yorumlar">

    </androidx.appcompat.widget.Toolbar>
    <androidx.recyclerview.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/toolbar_yorumlar"
        android:id="@+id/recycler_yorumlar"
        android:layout_above="@+id/bottom_relative">

    </androidx.recyclerview.widget.RecyclerView>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bottom_relative"
        android:background="#fff"
        android:padding="4dp"
        android:layout_alignParentBottom="true">
        <com.mikhaellopez.circularimageview.CircularImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:id="@+id/profilresmi_yorumlar"
            android:src="@mipmap/ic_launcher">
        </com.mikhaellopez.circularimageview.CircularImageView>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Yorumunuzu giriniz"
            android:layout_centerVertical="true"
            android:id="@+id/edit_yorumlar"
            android:layout_marginStart="10dp"
            android:layout_marginEnd="10dp"
            android:layout_toLeftOf="@+id/gonder"
            android:background="@android:color/transparent"
            android:layout_toRightOf="@+id/profilresmi_yorumlar"
            >
        </EditText>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:text="Gönder"
            android:id="@+id/gonder"
            android:layout_centerVertical="true"
            android:layout_marginEnd="5dp"
            android:layout_alignParentRight="true"
            android:layout_marginRight="5dp"
            android:textStyle="bold"
            android:textColor="@color/design_default_color_primary"></TextView>

    </RelativeLayout>

</RelativeLayout>

YorumyAz1片段.java:

public class Yorumyaz1Fragment extends Fragment {
    EditText edit_yorumlar;
    ImageView profilresmi_yorumlar;
    TextView gonder;
    String gonderi_id;
    String gonderen_id;
    FirebaseUser mevcutkullanici;
    private Intent intent;
    FirebaseDatabase firebaseDatabase;
    DatabaseReference reference;

    public void YorumlarFragment() {
        // Required empty public constructor
    }

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

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootview = inflater.inflate(R.layout.fragment_yorumyaz, container, false);
        Toolbar toolbar = (Toolbar) rootview.findViewById(R.id.toolbar_yorumlar);
        ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
        ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("Yorumlar");
        ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(v -> getActivity().finish());
        edit_yorumlar = (EditText) rootview.findViewById(R.id.edit_yorumlar);
        profilresmi_yorumlar = (ImageView) rootview.findViewById(R.id.profilresmi_yorumlar);
        gonder = (TextView) rootview.findViewById(R.id.gonder);
 mevcutkullanici= FirebaseAuth.getInstance().getCurrentUser();

        Intent intent= new Intent();
        gonderi_id=intent.getStringExtra("gonderi_id");
        gonderen_id=intent.getStringExtra("gonderen_id");

        gonder.setOnClickListener(v -> {
            if (edit_yorumlar.getText().toString().equals("")) {
                Toast.makeText(getActivity(), "Boş yorum gönderemezsiniz", Toast.LENGTH_LONG).show();

            } else {
                yorumEkle();
            }

        });

        return rootview;
    }

    private void yorumEkle() {
        DatabaseReference yorumlarYolu = FirebaseDatabase.getInstance().getReference("yorumlar").child(gonderi_id);

        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("yorum", edit_yorumlar.getText().toString());
        hashMap.put("gonderen", mevcutkullanici.getUid());
        yorumlarYolu.push().setValue(hashMap);
        edit_yorumlar.setText("");

 }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题