Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] javascript – mobile app bug report showing for self made app

Posted on November 11, 2022 By

Solution 1 :

Please change the button’s below statement which needs to indicate correct method when clicking actions made.

Please change in XML file of button from,

android:onClick="click"

to,

android:onClick="onClick"

Otherwise, please change method name in Java file as "click()"

Problem :

I am new in android learning Using this My app name is Threads.In Xml there is one Textview and button. When I click on button there will app shows “Threads has stopped” .

In this app I’m learning about how to us threads while developing app.

    package com.codewithjarvis.threads;

    import androidx.appcompat.app.AppCompatActivity;

    import android.os.Bundle;
    import android.view.View;
    import android.widget.TextView;
    import android.widget.Button;



    public class MainActivity extends AppCompatActivity {

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

        public void onClick(View view)
        {
            Button Vbutton =(Button)findViewById(R.id.Vbutton);
            long Ltime = System.currentTimeMillis() + 5*1000;
            while (System.currentTimeMillis()< Ltime)
            {
                synchronized (this)
                {
                    try{
                        wait(Ltime - System.currentTimeMillis());
                    }catch (Exception e){}
                }
            }
            TextView Vtext = (TextView)findViewById(R.id.Vtext);
            Vtext.setText("hello frands this is surbhi");
        }
    }
    <?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout xmlns_android="http://schemas.android.com/apk/res/android"
        xmlns_app="http://schemas.android.com/apk/res-auto"
        xmlns_tools="http://schemas.android.com/tools"
        android_layout_width="match_parent"
        android_layout_height="match_parent"
        tools_context=".MainActivity">

        <TextView
            android_id="@+id/Vtext"
            android_layout_width="wrap_content"
            android_layout_height="wrap_content"
            android_layout_marginTop="120dp"
            android_text="TextView"
            android_textSize="30sp"
            app_layout_constraintEnd_toEndOf="parent"
            app_layout_constraintStart_toStartOf="parent"
            app_layout_constraintTop_toTopOf="parent" />

        <Button
            android_id="@+id/Vbutton"
            android_layout_width="wrap_content"
            android_layout_height="wrap_content"
            android_layout_marginTop="296dp"
            android_onClick="click"
            android_text="Button"
            app_layout_constraintEnd_toEndOf="parent"
            app_layout_constraintHorizontal_bias="0.498"
            app_layout_constraintStart_toStartOf="parent"
            app_layout_constraintTop_toBottomOf="@+id/Vtext" />
    </androidx.constraintlayout.widget.ConstraintLayout>

why my app showing stopped in android phone? is there any bug or any error in my code
when I’m running this code it shows
Send bug report to Mi for analysis? This report may contain personally identifiable information. your report will be used to help fix this bug and will never be shared in any commercial context.

Comments

Comment posted by Surbhi Bansal

Same problem comes in my other program too…So how can I check where is the problem in my program?

READ  [FIXED] java - How to send images from PC to Android by using Socket?
Powered by Inline Related Posts

Comment posted by Gowrishankar

@SurbhiBansal when you gave method which needs to trigger while doing click action, the method name gave in XML file and defined method name in JAVA file should be the same. If its mismatch, the crash will occur and the app stops unexpectedly.

Android Tags:android, android-studio, bug-reporting, java, javascript

Post navigation

Previous Post: [FIXED] android – How to achieve ionic permissions on first load
Next Post: [FIXED] android – How do i put online database into local database

Related Posts

[FIXED] c# – Xamarin Creating Custom Buttons with FontAwesome Android
[FIXED] android – LiveDataScope emit not calling Android
[FIXED] android – Downloaded Media from firebase storage does’not appear in gallery but appears in file explorer Android
[FIXED] android – FCM working in emulator, but not on real device Android
[FIXED] Xamarin Native Android LinearLayout weight applied to a children weird problem Android
[FIXED] android – Is it possible in mapbox directions api to avoid a certain point? Android

Archives

  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can Vicks humidifier be used without filter?
  • What color is Spanish green?
  • How old is Jamie in The War That Saved My Life?
  • When should I use scalp massager for hair growth?
  • Can I put polyurethane over liming wax?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme