Android Studio中SETAFFINITY ret=-1的含义是什么?这是我的活动日志

Android Studio中SETAFFINITY ret=-1的含义是什么?这是我的活动日志,android,android-studio,Android,Android Studio,在下面的代码中,我在autocomplete_next TextView中设置了新的意图,但在我的手机中,当我运行应用程序时,当我尝试移动到下一个活动时,它不会进入下一个活动,相反,它会再次返回到相同的前一个活动。在Android Studio LOGCAT中,我看到了RenderScript:SETAFFINITY ret=-1。我在谷歌上找不到这个错误的线索?请帮我解决我的问题。提前谢谢你 activity_calculator.xml LOGCAT 您可以添加活动的完整代码吗?这是我的完整

在下面的代码中,我在autocomplete_next TextView中设置了新的意图,但在我的手机中,当我运行应用程序时,当我尝试移动到下一个活动时,它不会进入下一个活动,相反,它会再次返回到相同的前一个活动。在Android Studio LOGCAT中,我看到了
RenderScript:SETAFFINITY ret=-1
。我在谷歌上找不到这个错误的线索?请帮我解决我的问题。提前谢谢你

activity_calculator.xml

LOGCAT


您可以添加活动的完整代码吗?这是我的完整代码添加了调用活动和带有XML布局的调用活动。似乎还有第三个活动称为“AlarmActivity”,但您没有为其提供代码。您是否在这一行“label_text=findviewbyd(R.id.label_textView);”中输入了错误?Bkoz没有像“label\u textView”这样的id,我运行您的代码,从Calculator活动到AutoCompleteTactivity的转换工作正常。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".CalculatorActivity"
    android:layout_centerHorizontal="true">

   <TableLayout
       android:id="@+id/tableinput"
       android:layout_width="match_parent"
       android:layout_height="wrap_content">
       <TableRow
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:layout_margin="5dp">
           <TextView
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="Operand 1 : "
               android:textSize="20dp"
               android:textAlignment="textStart"
               />

           <EditText
               android:id="@+id/oper1_edit_text"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:textSize="20dp"
               android:layout_weight="1"/>
       </TableRow>

       <TableRow
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:layout_margin="5dp">
           <TextView
               android:id="@+id/autocomplete_textView"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="Operand 2 : "
               android:textSize="20dp"
               android:textAlignment="textStart"
               android:layout_weight="0"/>
           <EditText
               android:id="@+id/oper2_edit_text"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:textSize="20dp"
               android:layout_weight="1"/>
       </TableRow>
   </TableLayout>

    <GridLayout
        android:id="@+id/calculator"
        android:layout_below="@id/tableinput"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true">

        <Button
            android:id="@+id/add_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="0"
            android:layout_column="0"
            android:text="Add"/>

        <Button
            android:id="@+id/sub_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="0"
            android:layout_column="1"
            android:text="Sub"/>
        <Button
            android:id="@+id/min_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="0"
            android:layout_column="2"
            android:text="Min"/>

        <Button
            android:id="@+id/mul_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="1"
            android:layout_column="0"
            android:text="Multiply"/>

        <Button
            android:id="@+id/div_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="1"
            android:layout_column="1"
            android:text="Divide"/>
        <Button
            android:id="@+id/pow_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="2"
            android:layout_column="1"
            android:text="Power"/>

        <Button
            android:id="@+id/max_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="1"
            android:layout_column="2"
            android:text="Max"/>

        <Button
            android:id="@+id/rem_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="2"
            android:layout_column="0"
            android:text="Remainder"/>

        <Button
            android:id="@+id/clear_btn"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="2dp"
            android:textSize="20dp"
            android:layout_row="2"
            android:layout_column="2"
            android:text="clear"/>

    </GridLayout>

    <TableRow
        android:layout_below="@id/calculator"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp">
        <TextView
            android:id="@+id/video_textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Ans: "
            android:textSize="20dp"
            android:textAlignment="textStart"
            android:layout_weight="0"/>
        <EditText
            android:id="@+id/ans_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="20dp"
            android:layout_weight="1"/>
    </TableRow>
</RelativeLayout>
package com.example.lab_excercise_2;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import java.lang.Math;

public class CalculatorActivity extends AppCompatActivity {

private EditText oper1, oper2, ans;
private Button add_btn, sub_btn, div_btn, mul_btn, rem_btn, max_btn, min_btn, pow_btn, clear_btn;
private Integer oper1_text, oper2_text;
private TextView video_next,autocomplete_next;


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

    add_btn = findViewById(R.id.add_btn);
    sub_btn = findViewById(R.id.sub_btn);
    mul_btn = findViewById(R.id.mul_btn);
    div_btn = findViewById(R.id.div_btn);
    rem_btn = findViewById(R.id.rem_btn);
    min_btn = findViewById(R.id.min_btn);
    max_btn = findViewById(R.id.max_btn);
    pow_btn = findViewById(R.id.pow_btn);
    clear_btn = findViewById(R.id.clear_btn);
    oper1 = findViewById(R.id.oper1_edit_text);
    oper2 = findViewById(R.id.oper2_edit_text);
    ans = findViewById(R.id.ans_edit_text);

    video_next = findViewById(R.id.video_textView);
    autocomplete_next = findViewById(R.id.autocomplete_textView);

    add_btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        oper1_text=Integer.parseInt(oper1.getText().toString());
        oper2_text=Integer.parseInt(oper2.getText().toString());
        ans.setText(String.valueOf(oper1_text+oper2_text));
    }
});
    sub_btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        oper1_text=Integer.parseInt(oper1.getText().toString());
        oper2_text=Integer.parseInt(oper2.getText().toString());
        ans.setText(String.valueOf(oper1_text-oper2_text));
    }
});
    mul_btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        oper1_text=Integer.parseInt(oper1.getText().toString());
        oper2_text=Integer.parseInt(oper2.getText().toString());
        ans.setText(String.valueOf(oper1_text*oper2_text));
    }
});
    div_btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        oper1_text=Integer.parseInt(oper1.getText().toString());
        oper2_text=Integer.parseInt(oper2.getText().toString());
        ans.setText(String.valueOf(oper1_text/oper2_text));
    }
});
    rem_btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        oper1_text=Integer.parseInt(oper1.getText().toString());
        oper2_text=Integer.parseInt(oper2.getText().toString());
        ans.setText(String.valueOf(oper1_text%oper2_text));
    }
});
    max_btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        oper1_text=Integer.parseInt(oper1.getText().toString());
        oper2_text=Integer.parseInt(oper2.getText().toString());
        ans.setText((oper1_text>oper2_text ? oper1_text: oper2_text).toString());
    }
});

    min_btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        oper1_text=Integer.parseInt(oper1.getText().toString());
        oper2_text=Integer.parseInt(oper2.getText().toString());
        ans.setText((oper1_text<oper2_text ? oper1_text: oper2_text).toString());
    }
});

    pow_btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            oper1_text=Integer.parseInt(oper1.getText().toString());
            oper2_text=Integer.parseInt(oper2.getText().toString());
            Double pow = Math.pow(oper1_text,oper2_text);
            ans.setText(pow.toString());
        }
    });

    clear_btn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        oper1.setText("");
        oper2.setText("");
        ans.setText("");
    }

});

    video_next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent videoIntent = new Intent(CalculatorActivity.this,VideoActivity.class);
            startActivity(videoIntent);
        }
    });

    autocomplete_next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent autocompleteIntent = new Intent(CalculatorActivity.this,AutocompleteActivity.class);
            startActivity(autocompleteIntent);
        }
    });

}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".AutocompleteActivity">

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:textSize="30sp"
            android:textAlignment="center"
            android:layout_width="wrap_content"
            android:text="Date-Time Picker Autocomplete"
            android:textStyle="bold"
            android:textColor="@color/colorPrimary"
            android:layout_margin="20dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"/>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <Button
                android:id="@+id/setTime_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary"
                android:textColor="@android:color/white"
                android:text="Set Time"
                android:layout_weight="1"
                android:layout_margin="20dp"/>

            <TextView
                android:id="@+id/time_text"
                android:textSize="20sp"
                android:textAlignment="center"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="20dp"
                android:layout_weight="3"/>

        </TableRow>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <Button
                android:id="@+id/setDate_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary"
                android:textColor="@android:color/white"
                android:text="Set Date"
                android:layout_margin="20dp"
                android:layout_weight="1" />

            <TextView
                android:id="@+id/date_text"
                android:textSize="20sp"
                android:textAlignment="center"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="20dp"
                android:layout_weight="3"/>

        </TableRow>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/label_text"
                android:textSize="20sp"
                android:textAlignment="center"
                android:layout_width="wrap_content"
                android:text="Label  "
                android:textStyle="bold"
                android:textColor="@color/colorPrimary"
                android:layout_margin="20dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"/>

            <MultiAutoCompleteTextView
                android:id="@+id/label_edit"
                android:textSize="20sp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="20dp"
                android:layout_weight="3" />



        </TableRow>

        <Button
            android:id="@+id/setalarm_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:textColor="@android:color/white"
            android:layout_margin="20dp"
            android:text="Set Time" />

    </TableLayout>

</RelativeLayout>
package com.example.lab_excercise_2;

import androidx.appcompat.app.AppCompatActivity;

import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.MultiAutoCompleteTextView;
import android.widget.TextView;
import android.widget.TimePicker;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class AutocompleteActivity extends AppCompatActivity {

private Button setTime, setDate, setalarm;
private TextView time_text, date_text, label_text;
private Calendar calendar = Calendar.getInstance();
private String date_string, time_string, label_string;
private String[] labels = {"Wake Up","Time to School","Time to College","Time to Work","Complete Activity","Finish Project"};
private MultiAutoCompleteTextView label_autocomplete;


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

    setTime = findViewById(R.id.setTime_btn);
    setDate = findViewById(R.id.setDate_btn);
    setalarm = findViewById(R.id.setalarm_btn);
    time_text = findViewById(R.id.time_text);
    date_text = findViewById(R.id.date_text);
    label_autocomplete = findViewById(R.id.label_edit);
    label_text = findViewById(R.id.label_textView);

    setDate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showDateDialog(setDate);
        }
    });

    setTime.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showTimeDialog(setTime);
        }
    });

    setalarm.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            nextpage(v);
        }
    });

    label_autocomplete.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent alarmIntent = new Intent(AutocompleteActivity.this,AlarmActivity.class);
            startActivity(alarmIntent);
        }
    });

    label_text.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent alarmIntent = new Intent(AutocompleteActivity.this,AlarmActivity.class);
            startActivity(alarmIntent);
        }
    });

    ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1,labels);
    label_autocomplete.setAdapter(adapter);
    label_autocomplete.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());


}

public void showTimeDialog(final Button time){
    TimePickerDialog.OnTimeSetListener timeSetListener = new TimePickerDialog.OnTimeSetListener() {
        @Override
        public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
            calendar.set(Calendar.HOUR_OF_DAY,hourOfDay);
            calendar.set(Calendar.MINUTE,minute);
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
            time_text.setText(simpleDateFormat.format(calendar.getTime()));
        }
    };
    new TimePickerDialog(AutocompleteActivity.this,timeSetListener,calendar.get(Calendar.HOUR_OF_DAY),calendar.get(Calendar.MINUTE),false).show();
}

public void showDateDialog(final Button date){
    DatePickerDialog.OnDateSetListener dateSetListener = new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
            calendar.set(Calendar.YEAR,year);
            calendar.set(Calendar.MONTH,month);
            calendar.set(Calendar.DAY_OF_MONTH,dayOfMonth);
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy-MM-dd");
            date_text.setText(simpleDateFormat.format(calendar.getTime()));
        }
    };
    new DatePickerDialog(AutocompleteActivity.this, dateSetListener,calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH)).show();
}

public void nextpage(View view){
    date_string = date_text.getText().toString();
    time_string = time_text.getText().toString();
    label_string = label_autocomplete.getText().toString();
    Intent nextIntent = new Intent(this,Autocomplete2Activity.class);
    nextIntent.putExtra("date",date_string);
    nextIntent.putExtra("time",time_string);
    nextIntent.putExtra("label",label_string);
    startActivity(nextIntent);

}
}
2020-03-02 19:55:10.865 4078-4136/com.example.lab_excercise_2E/RenderScript: SETAFFINITY ret = -1
2020-03-02 19:55:10.865 4078-4137/com.example.lab_excercise_2 E/RenderScript: SETAFFINITY ret = -1
2020-03-02 19:55:10.865 4078-4139/com.example.lab_excercise_2 E/RenderScript: SETAFFINITY ret = -1
2020-03-02 19:55:10.865 4078-4138/com.example.lab_excercise_2 E/RenderScript: SETAFFINITY ret = -1
2020-03-02 19:55:10.865 4078-4140/com.example.lab_excercise_2 E/RenderScript: SETAFFINITY ret = -1
2020-03-02 19:55:10.865 4078-4142/com.example.lab_excercise_2 E/RenderScript: SETAFFINITY ret = -1
2020-03-02 19:55:10.865 4078-4141/com.example.lab_excercise_2 E/RenderScript: SETAFFINITY ret = -1`