Caused by: java.lang.NullPointerException 04-07 04:36:57.490: E/AndroidRuntime(1176): at android.content.ContextWrapper.getResources(ContextWrapper.java:89)
You are using this
getResources().getString(R.string.dialogc)
outside onCreate
. Move it inside onCreate
.
http://developer.android.com/reference/android/content/Context.html#getResources()
public abstract Resources getResources ()
Added in API level 1
Return a Resources instance for your application's package.
getResources()
is a method of Context and context is available once Activity is created.
String[] numbers;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
numbers = new String[] {
"1", "2", "3", "4", "5",
"6", "7", "8", "9", "0",getResources().getString(R.string.dialogc)};
Edit:
java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
You have not referenced AppCompat properly. Hence the problem
Check this Adding libraries with resources.
https://developer.android.com/tools/support-library/setup.html
and follow the steps accordingly