I have a problem,
I can't get my button to work
On click it should switch from MainActivity to Login
Both classes work fine without the Button,
but now, as I brought in the Button, it keeps crashing.
What am I doing wrong?
This Button, which brings me from login to Mainactivity, works just fine:
public class login extends Activity {
Button b1,b2;
EditText ed1,ed2;
TextView tx1;
int counter = 3;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setContentView(R.layout.login);
b1 = (Button)findViewById(R.id.button);
ed1 = (EditText)findViewById(R.id.editText);
ed2 = (EditText)findViewById(R.id.editText2);
b2 = (Button)findViewById(R.id.button2);
tx1 = (TextView)findViewById(R.id.textView3);
tx1.setVisibility(View.GONE);
b1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if(ed1.getText().toString().equals("admin") && ed2.getText().toString().equals("admin")) {
Toast.makeText(getApplicationContext(),"Redirecting...",Toast.LENGTH_SHORT).show();
Intent i = new Intent(login.this, MainActivity.class);
startActivity(i);
}
else{
Toast.makeText(getApplicationContext(), "Fehlerhafte Eingabe",Toast.LENGTH_SHORT).show();
tx1.setVisibility(View.VISIBLE);
tx1.setBackgroundColor(Color.RED);
counter--;
tx1.setText(Integer.toString(counter));
if (counter == 0) {
b1.setEnabled(false);
}
}
}
});
b2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
finish();
}
});
}
}
Button code
StrgS.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
{
Toast.makeText(getApplicationContext(), "Goodbye", Toast.LENGTH_LONG).show();
Intent j = new Intent(MainActivity.this, login.class);
startActivity(j);
}
}
});
}
}
Error Code
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.cris.zeiterfassungv2, PID: 10555
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cris.zeiterfassungv2/com.example.cris.zeiterfassungv2.MainActivity}: android.view.InflateException: Binary XML file line #0: Can't convert value at index 6 to dimension: type=0x12
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #0: Can't convert value at index 6 to dimension: type=0x12
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 6 to dimension: type=0x12
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:730)
at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:7797)
at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1976)
at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1874)
at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1872)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.cris.zeiterfassungv2.MainActivity.onCreate(MainActivity.java:76)
at android.app.Activity.performCreate(Activity.java:6999)
at android.app.Activity.performCreate(Activity.java:6990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Thank you
Related
My Android App crashes as soon as I click a button, while it is connected to Firebase. I copied the same application in a new Project, without connecting it to Firebase and it didn't crashed. How can I avoid the crashing of the App
Here is my app gradle:
The Error I get in the Logcat:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.paragleid_app/com.example.paragleid_app.Regestration}: java.lang.IllegalAccessException: void com.example.paragleid_app.Regestration.<init>() is not accessible from java.lang.Class<android.app.Instrumentation>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2850)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3059)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.IllegalAccessException: void com.example.paragleid_app.Regestration.<init>() is not accessible from java.lang.Class<android.app.Instrumentation>
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1182)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2840)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3059)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
LoginActvity:
theName = Name.getText().toString();
thePassword = Passwort.getText().toString();
Registieren.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
openRegestration();
}
});
Login.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
FirebaseFirestore db = FirebaseFirestore.getInstance();
CollectionReference myCoRef = db.collection("User");
db.collection("Users")
.whereEqualTo("Password", thePassword) // task to query if name and Password matches
.whereEqualTo("name", theName)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
#Override
public void onComplete(#NonNull Task<QuerySnapshot> task) {
if(task.isSuccessful()) {
//QuerySnapshot result = task.getResult();
Toast toast = Toast. makeText(getApplicationContext(),"Login Successful", Toast. LENGTH_SHORT);
openVereinsUebersicht();
} else {
Toast toast = Toast.makeText(getApplicationContext(), "Login wasn't successful", Toast.LENGTH_LONG);
}
}
});
}
});
As soon as this line comes to operation: the App crashes
public void openRegestration () {
Intent intent = new Intent(this, Regestration.class);
startActivity(intent);
}
I know this has been asked multiple times, and I been trying to fix it, but I really can't seem to understand what the problem is. I'm really new to Android Studio and Android Room, so if I'm honest, I barely have a clue what I'm doing. I assume the error occurs in my "MainActivity.java" class based off what the logcat tells me. This is my logcat
2020-06-15 01:33:41.885 21773-21773/com.example.hoply5 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.hoply5, PID: 21773
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.hoply5/com.example.hoply5.MainActivity}: java.lang.ClassCastException: com.example.hoply5.MainActivity cannot be cast to android.app.Activity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3272)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3500)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2049)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
Caused by: java.lang.ClassCastException: com.example.hoply5.MainActivity cannot be cast to android.app.Activity
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:41)
at android.app.Instrumentation.newActivity(Instrumentation.java:1253)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3260)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3500)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2049)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
Here is my MainActivity class
public class SecondFragment extends Fragment {
EditText editTxtName, editTxtEmail, editTxtPwd, editTextCnfPwd;
Button backBtn, registerBtn;
private UserDao userDao;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_second, container, false);
editTxtName = view.findViewById(R.id.editName);
editTxtEmail = view.findViewById(R.id.editEmail);
editTxtPwd = view.findViewById(R.id.editPwd);
registerBtn = view.findViewById(R.id.registerBtn2);
editTextCnfPwd = view.findViewById(R.id.editCnfPwd);
backBtn = view.findViewById(R.id.backBtn);
backBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), MainActivity.class);
startActivity(intent);
}
});
userDao = Room.databaseBuilder(getActivity(), UserDatabase.class, "User").build().getUserDao();
registerBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String userName = editTxtName.getText().toString().trim();
String email = editTxtEmail.getText().toString().trim();
String password = editTxtPwd.getText().toString().trim();
String passwordCnf = editTextCnfPwd.getText().toString().trim();
if(password.equals(passwordCnf)) {
User user = new User(userName,password,email);
userDao.insert(user);
Intent transitionLogin = new Intent(getActivity(), MainActivity.class);
startActivity(transitionLogin);
} else {
Toast.makeText(getActivity(), "Password is not matching", Toast.LENGTH_SHORT).show();
}
}
});
return view;
}
}
Your MainActivity is Fragment,so you have to replace it
i face some errors when trying to run my app here is the logcat
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.chatapp/com.example.chatapp.MainActivity}: java.lang.InstantiationException: java.lang.Class<com.example.chatapp.MainActivity> has no zero argument constructor
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2843)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.InstantiationException: java.lang.Class<com.example.chatapp.MainActivity> has no zero argument constructor
and here is my mainAcivity
`public class MainActivity extends AppCompatActivity {
Button login, register;
FirebaseUser firebaseUser;
#Override
protected void onStart() {
super.onStart();
firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
//check if user in null
if (firebaseUser != null){
Intent intent = new Intent(MainActivity.this, Main2Activity.class);
new MainActivity(intent);
finish();
}
}
`
but also i think this is an error
public MainActivity(Intent intent) {
}
Activities do not need to be instantiated, so you only need to call the following to start one:
//check if user in null
if (firebaseUser != null){
Intent intent = new Intent(MainActivity.this, Main2Activity.class);
startActivity(intent);
finish();
}
Basically you only need to remove this line:
new MainActivity(intent);
And start the Activity with:
startActivity(intent);
I'm just learning some basics of Java and have little problem with my app
This is part of my MainActivity
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton button = (FloatingActionButton) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View v) {
EditText edit = (EditText) findViewById(R.id.editText);
if (edit.getText().toString().equals("admin")) {
Intent gz = new Intent(getApplicationContext(), gz.class);
startActivity(gz);
}
}
});
}
I would like that app changed activity from mainActivity to gz activity after click button and check EditText edit.
At this stage app just crash.
--------- beginning of crash
08-16 12:50:38.284 9345-9345/com.example.fiery.app1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.fiery.app1, PID: 9345
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fiery.app1/com.example.fiery.app1.MainActivity}: java.lang.ClassCastException: android.support.v7.widget.AppCompatButton cannot be cast to android.support.design.widget.FloatingActionButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2434)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: java.lang.ClassCastException: android.support.v7.widget.AppCompatButton cannot be cast to android.support.design.widget.FloatingActionButton
at com.example.fiery.app1.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:6272)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
you are intialize your button in wrong way,You can try to cast yout widget button to FloatingActionButtonyou and it's not possible please just change Like this
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View v) {
EditText edit = (EditText) findViewById(R.id.editText);
if (edit.getText().toString().equals("admin")) {
Intent gz = new Intent(getApplicationContext(), gz.class);
startActivity(gz);
}
}
});
public class ChildrensList extends Fragment {
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.childrens_list,container,false);
//return rootView;
ImageButton pigsButton = (ImageButton) rootView.findViewById(R.id.pigsButton);
ImageButton jackButton = (ImageButton) rootView.findViewById(R.id.jacksButton);
ImageButton hansgretButton = (ImageButton) rootView.findViewById(R.id.hansgretButton);
ImageButton mermadButton = (ImageButton) rootView.findViewById(R.id.mermaidButton);
ImageButton rapButton = (ImageButton) rootView.findViewById(R.id.rapunzalButton);
ImageButton redRidButton = (ImageButton) rootView.findViewById(R.id.ridingButton);
ImageButton threeBearsButton = (ImageButton) rootView.findViewById(R.id.bearsButton);
ImageButton ugduckButton = (ImageButton) rootView.findViewById(R.id.duckButton);
final MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.xlophone);
pigsButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(ChildrensList.this.getActivity(),pigs_story.class);
mp.start();
startActivity(i);
}
});
jackButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(ChildrensList.this.getActivity(), jack_beanstalk.class);
mp.start();
startActivity(i);
}
});
hansgretButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(ChildrensList.this.getActivity(), hansel_and_gretal.class);
mp.start();
startActivity(i);
}
});
mermadButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(ChildrensList.this.getActivity(), mermaid.class);
mp.start();
startActivity(i);
}
});
rapButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(ChildrensList.this.getActivity(), rapunzal.class);
mp.start();
startActivity(i);
}
});
redRidButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(ChildrensList.this.getActivity(), RedRidingHood.class);
mp.start();
startActivity(i);
}
});
threeBearsButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(ChildrensList.this.getActivity(), ThreeBears.class);
mp.start();
startActivity(i);
}
});
ugduckButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(ChildrensList.this.getActivity(), UglyDuckling.class);
mp.start();
startActivity(i);
}
});
return rootView; //return rootview
}
}
I am having some errors appear in the console and struggling with how to resolve them, one of them is a fatal out of memory exception but there is a long list! could someone shed some light on this and help to rid the errors
04-19 18:47:29.392 19101-19101/com.j2d.com.bedtimestories E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.j2d.com.bedtimestories, PID: 19101
android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.widget.ScrollView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at com.j2d.com.bedtimestories.ChildrensList.onCreateView(ChildrensList.java:25)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.ScrollView
at android.view.LayoutInflater.createView(LayoutInflater.java:657)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:706)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:774)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at com.j2d.com.bedtimestories.ChildrensList.onCreateView(ChildrensList.java:25)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:706)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:774)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at com.j2d.com.bedtimestories.ChildrensList.onCreateView(ChildrensList.java:25)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 22075212 byte allocation with 16777216 free bytes and 17MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:856)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:675)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:2228)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:4211)
at android.content.res.Resources.loadDrawable(Resources.java:4085)
at android.content.res.Resources.loadDrawable(Resources.java:3935)
at android.content.res.TypedArray.getDrawable(TypedArray.java:886)
at android.view.View.<init>(View.java:4225)
at android.view.ViewGroup.<init>(ViewGroup.java:589)
at android.widget.FrameLayout.<init>(FrameLayout.java:97)
at android.widget.ScrollView.<init>(ScrollView.java:347)
at android.widget.ScrollView.<init>(ScrollView.java:343)
at android.widget.ScrollView.<init>(ScrollView.java:339)
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:706)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:774)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at com.j2d.com.bedtimestories.ChildrensList.onCreateView(ChildrensList.java:25)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
The key part of the error you posted is this:
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 22075212 byte allocation with 16777216 free bytes and 17MB until OOM
[...]
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:856)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:675)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:2228)
[...]
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at com.j2d.com.bedtimestories.ChildrensList.onCreateView(ChildrensList.java:25)
[...]
This says your app ran out of memory. It ran out of memory while trying to load an image, which it did when your ChildrensList class, in the onCreateView() method, called .inflate().
As someone else noted in a comment on your question, it is likely that you have very large image file(s) in your app. You should scale the images to an appropriate size to avoid this issue.
The Android documentation has an article discussing image sizes.