мое приложение не получает данные из моей базы данных. это показывает пустое текстовое представление и говорит об ошибках на logcat, который дан ниже .... пожалуйста, помогите мне. Срок выполнения работы истекает .....
2020-02-26 11: 53: 30.062 29392-29392 / com.example.d_specs I / TextToSpeech: успешно связан с com.google. android .tts 2020-02-26 11: 53: 30.070 29392-29418 / com.example.d_specs D / ColorExSystemServiceHelper: checkColorExSystemService className = com.google. android .tts.service.GoogleTTSService 2020-02-26 11: 53: 30.075 29392-29392 / com.example.d_specs D / WindowManager: Добавить в mViews: DecorView@fa8568c [SecondOneActivity], это = android .view. WindowManagerGlobal@b0c7f51, pkg = com.example.d_specs 2020-02- 26 11: 53: 30.083 29392-29392 / com.example.d_specs I / TextToSpeech: подключен к ComponentInfo {com.google. android .tts / com.google. android .tts.service.GoogleTTSService} 2020-02 -26 11: 53: 30.091 29392-29497 / com.example.d_specs I / TextToSpeech: настроить соединение с ComponentInfo {com.google. android .tts / com.google. android .tts.service.GoogleTTSService} 2020-02-26 11: 53: 30.264 29392-29392 / com.example.d_specs I / Хореограф: пропущено 8 кадров! Приложение может выполнять слишком много работы в своем основном потоке. 2020-02-26 11: 53: 30.553 29392-29392 / com.example.d_specs D / SurfaceView: 238649477 updateRequestedVisibility, mViewVisibility: true, mWindowVisibility: false, mWindowStopped: false by android .view.SurfaceView.onWindowVisibilityChanged: 292 1015 * .view.View.dispatchWindowVisibilityChanged: 13970 android .view.ViewGroup.dispatchWindowVisibilityChanged: 1580 android .view.ViewGroup.dispatchWindowVisibilityChanged: 1580 android .view.ViewGroup.dis80hanged Window:. .dispatchWindowVisibilityChanged: 1580 android .view.ViewGroup.dispatchWindowVisibilityChanged: 1580 android .view.ViewGroup.dispatchWindowVisibilityChanged: 1580 2020-02-26 11: 53: 30.553 29392-29392 / com.example. Id .6464 Изменения: создание = false формат = false размер = false видимый = true left = false top = false 2020-02-26 11: 53: 30.553 29392-29392 / com.example.d_specs I / SurfaceView: 238649477 Кривая поверхность: поверхность (имя = null) / @ 0xfeb1e8, видимый = false 2020-02-26 11: 53: 30.555 29392-29392 / com.example.d_specs I / SurfaceView: 238649477 visibleChanged: true -> SurfaceHolder.Callback.surfaceDestroyed 2020-02-26 11: 53: 30.557 29392-29392 / com.example.d_specs V / SurfaceView: макет: x = 0 y = 264 w = 1094 h = 1944, frame = Rect (0, 0 - 1094, 1944) 2020-02-26 11: 53: 30.559 29392-29480 / com.example.d_specs D / SurfaceView: 135700481 windowPositionLost, frameNr = 0 2020-02-26 11: 53: 30.576 29392-29392 / com.example.d_specs D / SurfaceView: 238649477 updateRequestedVisibility, mViewVisibility: true, mWindowVisibility: false, mWindowStopped: true при android .view.SurfaceView.windowStopped: 264 android .view.Ro. setWindowStopped: 1722 android .view.WindowManagerGlobal.setStoppedState: 685 android .app.Activity.performStop: 8206 android .app.ActivityThread.callActivityOnStop: 4899 android .app.ActivityThread.performStopActivityInner 4828: .app.ActivityThread.handleStopActivity: 4959 android .app.servertransaction.StopActivityItem.execute: 41 2020-02-26 11: 54: 08.979 29392-29392 / com.example.d_specs I / Хореограф: пропущено 2 кадра! Приложение может выполнять слишком много работы над своим основным потоком.
import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull;
import androidx.core.view.GestureDetectorCompat;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import java.util.ArrayList;
import java.util.Locale;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
public class SecondOneActivity extends AppCompatActivity implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {
private static final String TAG = "SampleActivity";
private GestureDetectorCompat GestureDetect;
private TextToSpeech tts;
TextToSpeech txt;
//array declaration
ArrayList<String> array1;
ArrayList<String> array2;
//global variable
String glo;
String nameget;
String priceget;
TextView text;
FirebaseAuth firebaseAuth;
FirebaseUser firebaseUser;
DatabaseReference databasefetch;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second_one);
Bundle bundle = getIntent().getExtras(); //get the intent and data passed
//next check that bundle is not null
if (bundle != null) {
String scanResult = bundle.getString("SCAN_RESULT");
//try loging out the value
Log.i("value", scanResult);
glo = scanResult;
}
//typeCast
long l = Long.parseLong(glo);
//initialize arraylists
array1 = new ArrayList<String>();
array2 = new ArrayList<String>();
txt=new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if(status!=TextToSpeech.ERROR)
{
txt.setLanguage(Locale.UK);
}
}
});
GestureDetect = new GestureDetectorCompat(this,this);
GestureDetect.setOnDoubleTapListener(this);
text = (TextView) findViewById(R.id.textView3);
//database initialize
firebaseAuth = FirebaseAuth.getInstance();
firebaseUser = firebaseAuth.getCurrentUser();
//database data fetching : from here onwards
//database query as "select * from save where id=l;
databasefetch = FirebaseDatabase.getInstance().getReference().child("DPOS");
Query query = databasefetch.orderByChild("id").equalTo(l);
query.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
Log.i("TAG", "sujith annan");
String name = snapshot.child("name").getValue().toString();
String details = snapshot.child("details").getValue().toString();
String price = snapshot.child("price").getValue().toString();
// nameget = name;
// priceget = price;
text = (TextView) findViewById(R.id.textView3);
//to print
text.setText("\nProduct Name : " + name + "\nDetails : " + details + "\nPrice : " + price);
//text to speech
String toSpeak = text.getText().toString();
Toast.makeText(getApplicationContext(),toSpeak,Toast.LENGTH_SHORT).show();
txt.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
throw databaseError.toException(); // never ignore errors
}
});
}
@Override
public boolean onTouchEvent(MotionEvent event) {
GestureDetect.onTouchEvent(event);
return super.onTouchEvent(event);
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
//text to speech
String toSpeak = text.getText().toString();
Toast.makeText(getApplicationContext(),toSpeak,Toast.LENGTH_SHORT).show();
txt.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
return false;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
Intent intent=new Intent(SecondOneActivity.this,SecondActivity.class);
startActivity(intent);
return false;
}
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
return false;
}
@Override
public boolean onDown(MotionEvent e) {
return false;
}
@Override
public void onShowPress(MotionEvent e) {
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
return false;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
return false;
}
@Override
public void onLongPress(MotionEvent e) {
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
Toast.makeText(this,"Item saved for billing",Toast.LENGTH_SHORT).show();
array1.add(nameget);
array2.add(priceget);
return false;
}
@Override
public void onBackPressed() {
Intent in =new Intent(this,BillingActivity.class);
in.putStringArrayListExtra("arr1",array1);
in.putStringArrayListExtra("arr2",array2);
startActivity(in);
super.onBackPressed();
}
}