Ну или подскажите как сделать переход из фрагмента в активити по нажатию на кнопку.
Intent intent = new Intent(getActivity(), YetAnotherActivity.class);
startActivity(intent);
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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"
android:background="@color/BackgroundContent"
tools:context="com.example.user.dbv2.Content_mainActivity"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="25dp">
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="23dp"
android:layout_marginBottom="50dp"
android:layout_marginTop="49dp"
android:text="Вождение"
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="@+id/textView7"
app:layout_constraintLeft_toLeftOf="@+id/textView7"
app:layout_constraintRight_toRightOf="@+id/textView4"
app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<TextView
android:id="@+id/textView4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Теория"
android:textSize="17sp"
app:layout_constraintBottom_toTopOf="@+id/textView8"
app:layout_constraintLeft_toLeftOf="@+id/textView8"
app:layout_constraintRight_toRightOf="@+id/teor"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"/>
<TextView
android:id="@+id/textView7"
android:layout_width="60dp"
android:layout_height="50dp"
android:layout_marginStart="108dp"
android:layout_marginTop="72dp"
android:gravity="center_vertical"
android:text="Где:"
android:textSize="17sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1"/>
<TextView
android:id="@+id/textView6"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center_vertical"
android:text="Когда:"
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="@+id/discr_for_tasks_test"
app:layout_constraintLeft_toLeftOf="@+id/textView7"
app:layout_constraintRight_toRightOf="@+id/textView7"
app:layout_constraintTop_toBottomOf="@+id/textView7"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<ListView
android:id="@+id/discr_for_tasks_test"
android:layout_width="0dp"
android:layout_height="50dp"
android:divider="@null"
android:textSize="17sp"
app:layout_constraintLeft_toLeftOf="@+id/discr_for_tasks"
app:layout_constraintRight_toRightOf="@+id/discr_for_tasks"
app:layout_constraintTop_toBottomOf="@+id/discr_for_tasks"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<TextView
android:id="@+id/textView8"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginTop="48dp"
android:gravity="center_vertical"
android:text="Где:"
android:textSize="17sp"
app:layout_constraintLeft_toLeftOf="@+id/textView6"
app:layout_constraintRight_toRightOf="@+id/textView6"
app:layout_constraintTop_toBottomOf="@+id/textView6"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<TextView
android:id="@+id/textView9"
android:layout_width="0dp"
android:layout_height="50dp"
android:gravity="center_vertical"
android:text="Когда:"
android:textSize="17sp"
app:layout_constraintLeft_toLeftOf="@+id/textView8"
app:layout_constraintRight_toRightOf="@+id/textView8"
app:layout_constraintTop_toBottomOf="@+id/textView8"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<ListView
android:id="@+id/discr_for_tasks"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="15dp"
android:layout_marginStart="1dp"
android:divider="@null"
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="@+id/textView7"
app:layout_constraintLeft_toRightOf="@+id/textView7"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<ListView
android:id="@+id/teor"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="1dp"
android:divider="@null"
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="@+id/textView8"
app:layout_constraintLeft_toRightOf="@+id/textView8"
app:layout_constraintRight_toRightOf="@+id/discr_for_tasks_test"
app:layout_constraintTop_toBottomOf="@+id/textView4"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<ListView
android:id="@+id/teor2"
android:layout_width="0dp"
android:layout_height="50dp"
android:divider="@null"
android:textSize="17sp"
app:layout_constraintLeft_toLeftOf="@+id/teor"
app:layout_constraintRight_toRightOf="@+id/teor"
app:layout_constraintTop_toBottomOf="@+id/teor"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#bdbdbd"/>
<corners android:radius="30dp" />
</shape>
</item>
</selector>
<Button
android:id ="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Some Button"
android:background="@drawable/rounded_button"
android:padding="16dp"/>
double output = Double.parseDouble(mEditText.getText().toString());
output = Math.round(output * 100.0) / 100.0;
mTextView.setText(String.valueOf(output));
output = Double.parseDouble(mEditText.getText().toString());
mTextView.setText(new DecimalFormat("##.##").format(output)); //import java.text.DecimalFormat;
ArrayList<News> news = new ArrayList<>();
news.add(new News(t, Double.parseDouble(p));
return news;
newsList.add(new News(t, Double.parseDouble(p));
return newsList;
/* Complex parts */
public class Input
{
public String test() {
return "sdas";
}
}
public class Input2
{
public String test2() {
return "sdas1";
}
}
/* Facade */
class InputFacade {
private Input input;
private Input2 input2;
public InputFacade() {
this.input = new Input();
this.input2 = new Input2();
}
public void startInput() {
input.test();
input2.test2();
System.out.println(input.test() + input2.test2());
}
}
/* Client */
class MyClass {
public static void main(String[] args) {
InputFacade input = new InputFacade();
input.startInput();
}
}
> sdassdas1
Желательно предоставить не сам метод, а набор знаний и источников для реализации данного метода.
MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.sound_file_1);
mediaPlayer.start();
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}