0

Ok, so I've overcome many errors, only for my application to crash upon me trying to access my second Activity. The errors point to my second activity's class, which is located inside of the layout class. I've tried to create my second activity's class inside of src, but Android Studio doesn't seem to want to let me. Has anyone else faced this problem, and do you have advice? Thank you. Here's the code for my 2nd Activity, and my AndroidManifest.

package com.example.friendlistcleaner.app;


import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class facebookhandler extends ActionBarActivity
{


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

    // Get the message from the intent
    Intent intent = getIntent();
    String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);

    // Create the text view
    TextView textView = new TextView(this);
    textView.setTextSize(40);
    textView.setText(message);

    // Set the text view as the activity layout
    setContentView(textView);

}


@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.facebookhandler, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

}

AndroidManifest

<?xml version="1.0" encoding="utf-8"?>
<!--
 * Copyright 2010-present Facebook.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.facebook.android">
<application/>
<uses-sdk android:minSdkVersion="8" />
    <activity
     android:name="com.example.FacebookCleaner.FacebookHandler"
     android:label="message"
     android:parentActivityName="com.example.FacebookCleaner.MainActivity" >
     <meta-data
         android:name="android.support.PARENT_ACTIVITY"
         android:value="com.example.FacebookCleaner.MainActivity" />
    </activity>
</manifest>

stack trace

04-26 22:43:44.803  32315-32315/com.example.friendlistcleaner.app D/libEGL﹕ loaded         /system/lib/egl/libEGL_adreno200.so
04-26 22:43:44.803  32315-32315/com.example.friendlistcleaner.app D/libEGL﹕ loaded    /system/lib/egl/libGLESv1_CM_adreno200.so
04-26 22:43:44.823  32315-32315/com.example.friendlistcleaner.app D/libEGL﹕ loaded /system/lib/egl/libGLESv2_adreno200.so
04-26 22:43:44.873  32315-32315/com.example.friendlistcleaner.app I/Adreno200-EGL﹕  <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build:    HAREESHG_Nondeterministic_AU+PATCH[ES]_msm8960_JB_1.9.6_MR2_CL3219408_release_ENGG   (CL3219408)
    Build Date: 09/28/13 Sat
    Local Branch: hhh
    Remote Branch: quic/jb_1.9.6_1
    Local Patches: 8d50ec23e42ef52b570aa6ff1650afac0b503d78 CL3219408: Fix in the   Glreadpixels for negative offsets and larger dimensions.
    801859126f6ca69482b39a34ca61447e3f7cded8 rb: fix panel settings to clear     undrawn/undefined buffers
    Reconstruct Branch: LOCAL_PATCH[ES]
04-26 22:43:45.093  32315-32315/com.example.friendlistcleaner.app D/OpenGLRenderer﹕     Enabling debug mode 0
04-26 22:43:45.163  32315-32315/com.example.friendlistcleaner.app D/OpenGLRenderer﹕ GL    error from OpenGLRenderer: 0x502
04-26 22:43:45.163  32315-32315/com.example.friendlistcleaner.app E/OpenGLRenderer﹕   GL_INVALID_OPERATION
Courtbird
  • 43
  • 1
  • 7
  • Add the stacktrace, please. – Blo Apr 27 '14 at 02:36
  • 1
    What's stacktrace? I'm sorry I'm rather new. – Courtbird Apr 27 '14 at 02:37
  • 1
    when an android app crashes, It'll show the error in your "logcat". In your development environment. The crash will give you both an error message for what happened, as well as a list of all the classes/functions in the current stack, which line and where it's crashing – arnorhs Apr 27 '14 at 02:43
  • 1
    Change `package="com.facebook.android"` to `package="com.example.FacebookCleaner"` in AndroidManifest – ρяσѕρєя K Apr 27 '14 at 02:43
  • It's the Logcat what I meant, sorry. Try [`alt+6`](http://stackoverflow.com/questions/16817566/logcat-is-gone-on-android-studio), there might be some revelant errors (in red normally) which inform you on what happened. – Blo Apr 27 '14 at 02:44
  • @ρяσѕρєяK I tried changing that, it just un-linked from the android libraries. lost access to the android libraries when I tried that one out. – Courtbird Apr 27 '14 at 02:52
  • @Fllo posted- I thought you were referring to something to do with stackoverflow when you said that :P – Courtbird Apr 27 '14 at 02:52

1 Answers1

0

My guess is that you should not create Activity inside layout. If you use Android Studio under the src folder right click on package name. Then choose "New" -> "Activity" etc. http://i57.tinypic.com/nezs5g.png

Besuglov Sergey
  • 506
  • 5
  • 20