Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialaustin morelli-saurdiff
835 PointsApp unable to start
in this app i have kept everything to the text seen on the app and i have done the work around on the Theme project, but now my app wont start it has something to do with my Main_Activity.Java file and i cant think of what i did wrong here is the code:
package com.example.crystalball;
import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView;
public class MainActivity<RelativeLayout> extends ActionBarActivity {
private Bundle savedInstanceState;
private CrystalBall mCrystalBall = new CrystalBall();
@Override
public void onCreate(Bundle savedInsanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Declare our View variables and assoign them the Views from the layout file
final TextView answerLabel = (TextView) findViewById(R.id.textView1);
Button getAnswerButton = (Button) findViewById(R.id.button1);
getAnswerButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String answer = mCrystalBall.getAnAnswer();
//Update the label with our dynamic answer
answerLabel.setText(answer);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
((MenuInflater) getMenuInflater()).inflate(R.menu.main, menu);
return true;
}
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);
}
} If anyone can take a look and give me some suggestion that would be most helpful im not far enough along to be able to debug this myself.
Thanks in advance.
4 Answers
ivicakartelo2
104 PointsEdit/Undu, save, run, .... and all the time like that till app start. After that Edit/Redo and app again stop - when you see instruction what produce stop, you delete that, and try make again, save, run... if stop again you again delete again make till you do not eliminate stop and like that to learn what you make wrong.
austin morelli-saurdiff
835 PointsI cant go back that far I mean i went through an entire few sessions before i found it would not start so im pretty far a ahead of the mistake did you see any clarical errors with the code where i might have missed something easy. there are no errors at all showing.
ivicakartelo2
104 PointsStart coding from begining again new app and very often control and like thet will not be long from that situation and can make Edit/Undo. You will learn lot of if work like this.
Hiroki Hokari
5,308 PointsIn the logcat, is there a red line saying FATAL EXCEPTION
following an orange line that goes like threadid=
?
If so, please copy it here.
In my case, this line of log solves 90% of all problems.
austin morelli-saurdiff
835 Pointsnot that it says
memtrack couldnt load memtrack module ( no such file or directory) "red line" then failed to load memtrack module: -2
other than that nothing along those lines that is the unfiltered log cat feedback i see it every time i start up and the end says something about no voice recognition but i dont need that.