Java 我/编舞:跳过了8帧!应用程序可能在其主线程上做了太多工作
我的应用程序没有从我的数据库中获取数据。它显示一个空白的文本视图,并在下面给出的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/colorexsystemserviceshelper:checkColorExSystemService className=com.google.android.tts.service.googletts服务 2020-02-26 11:53:30.075 29392-29392/com.example.d_specs d/WindowManager:添加到mViews:DecorView@fa8568c[SecondOneActivity],this=android.view。WindowManagerGlobal@b0c7f51,pkg=com.example.d_规格 2020-02-26 11:53:30.083 29392-29392/com.example.d_specs I/TextToSpeech:连接到组件信息{com.google.android.tts/com.google.android.tts.service.googlettssservice} 2020-02-26 11:53:30.091 29392-29497/com.example.d_specs I/TextToSpeech:设置到组件信息{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更新请求可见性,mViewVisibility:true,mWindowVisibility:false,mWindowStopped:false by android.view.SurfaceView.onWindowVisibilityChanged:292 android.view.view.dispatchWindowVisibilityChanged:13970 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 android.view.ViewGroup.dispatchWindowVisibilityChanged:1580 2020-02-26 11:53:30.553 29392-29392/com.example.d_specs I/SurfaceView:238649477更改:创建=假格式=假大小=假可见=真左=假顶=假 2020-02-26 11:53:30.553 29392-29392/com.example.d_specs I/SurfaceView:238649477 Cur surface:surface(name=null)/@0xfeb1e8,visible=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:Layout:x=0 y=264 w=1094 h=1944,frame=Rect(0,0-10941944) 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更新请求可见性,mViewVisibility:true,mWindowVisibility:false,mWindowStopped:true by android.view.SurfaceView.WindowsToped:264 android.view.ViewRootImpl.SetWindowsToped:1722 android.view.WindowManagerGlobal.setStoppedState:685 android.app.Activity.performStop:8206 android.app.ActivityThread.callActivityOnStop:4899 android.app.ActivityThread.performStopActivityInner:4877android.app.ActivityThread.HandleTopActivity:4959 android.app.servertransaction.StopActivityItem.execute:41 2020-02-26 11:54:08.979 29392-29392/com.example.d_specs I/编舞:跳过了两帧!应用程序可能在其主线程上做了太多工作Java 我/编舞:跳过了8帧!应用程序可能在其主线程上做了太多工作,java,android,firebase,Java,Android,Firebase,我的应用程序没有从我的数据库中获取数据。它显示一个空白的文本视图,并在下面给出的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/colorexsystemservices
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();
}
}
导入androidx.appcompat.app.appcompat活动;
导入androidx.annotation.NonNull;
导入androidx.core.view.GestureDetectorCompat;
导入android.content.Intent;
导入android.os.Bundle;
导入android.speech.tts.TextToSpeech;
导入android.util.Log;
导入android.view.GestureDetector;
导入android.view.MotionEvent;
导入java.util.ArrayList;
导入java.util.Locale;
导入android.widget.EditText;
导入android.widget.TextView;
导入android.widget.Toast;
导入com.google.firebase.auth.FirebaseAuth;
导入com.google.firebase.auth.FirebaseUser;
导入com.google.firebase.database.DataSnapshot;
导入com.google.firebase.database.DatabaseError;
导入com.google.firebase.database.DatabaseReference;
导入com.google.firebase.database.FirebaseDatabase;
导入com.google.firebase.database.Query;
导入com.google.firebase.database.ValueEventListener;
公共类SecondOneActivity扩展AppCompativeActivity实现GestureDetector.OnGetureListener、GestureDetector.OnDoubletaListener{
私有静态最终字符串TAG=“SampleActivity”;
私人手势检测器Compat GestureDetect;
私密文本语音tts;
texttospeechtxt;
//数组声明
ArrayList array1;
ArrayList array2;
//全局变量
字符串glo;
字符串nameget;
字符串价格;
文本查看文本;
FirebaseAuth FirebaseAuth;
FirebaseUser FirebaseUser;
数据库引用数据库获取;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity\u second\u one);
Bundle Bundle=getIntent().getExtras();//获取传递的意图和数据
//接下来检查bundle是否为null
if(bundle!=null){
String scanResult=bundle.getString(“扫描结果”);
//尝试登录该值
Log.i(“值”,扫描结果);
glo=扫描结果;
}
//打字
long l=long.parseLong(glo);
//初始化数组列表
array1=新的ArrayList();
array2=新的ArrayList();
txt=new TextToSpeech(getApplicationContext(),new TextToSpeech.OnInitListener()){
@凌驾
公共无效onInit(int状态){
if(状态!=TextToSpeech.ERROR)
{
setLanguage(Locale.UK);
}
}
});
GestureDetect=新的GestureDetectorCompat(这个,这个);
GestureDetect.setOnDoubleTapListener(此);
text=(TextView)findViewById(R.id.textView3);
//数据库初始化
火基