I am new in android learning Using this My app name is Trasition. In Xml there is one button. When I click on button I get the error Trasition has stopped
.
In this app we are doing when we click on screen buttons place get change and shift in the bottom in the screen.
In this constraintlayout id is activity_main.
Xml code:
<Button
android:id="@+id/button"
android:layout_marginTop="84dp"
android:text="Button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.17"
app:layout_constraintStart_toStartOf="parent"
app:layout_center code hereonstraintTop_toTopOf="parent" />
java code:
public class MainActivity extends AppCompatActivity{
ViewGroup activity_main;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
activity_main = (ViewGroup) findViewById(R.id.activity_main);
activity_main.setOnTouchListener(
new RelativeLayout.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionevent) {
moveButton();
return false;
}
}
);
}
public void moveButton(){
View button = findViewById(R.id.button)
positionRules.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,RelativeLayout.TRUE);
positionRules.addRule( RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
button.setLayoutParams(positionRules);
}
Why my app showing stopped in android phone? Is there any bug or error in my code when I'm running this code it shows:
send bug report to Mi for analysis?
This report may contain personality identifiable imformation.
Your report will be used to help fix this bug and will never be shared in any commercial context.
How can I solve crashing in java and xml. As I am a new learner. Please tell me the basic idea behind that crashing.