Please post your MainActivity file as well. But looking at the error what I can assume is this
You are instantiating some view. Let’s say a TextView.
And this is ur code.
public class MainActivity extends Activity {
TextView something = (TextView) findViewById(R.id.myTextView);
onCreate (Bundle savedinstancestate){
super.onCreate(.....
setContentView(R.layout.layout_main);
.......
And if this assumption was correct
Simply doing this
public class MainActivity extends Activity {
TextView something;
onCreate (Bundle savedinstancestate){
super.onCreate(.....
setContentView(R.layout.layout_main);
something = (TextView) findViewById(R.id.myTextView);
.........
Should work.
Hope it helps you. 🙂
2
solved Runtime Error Android Studio