I\'m using AndroidHive register login and it\'s working fine in example project of this login-register.
But after many attempts trying it with CardViews
In your AndroidManifest.xml add
<application android:name="YOURPACKAGENAME.AppController"
android:allowbackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
try this inside onCreate()
requestQueue=Volley.newRequestQueue(getApplicationContext());
In menifest file add appcontroller as shown
<application android:name="app.AppController"
android:allowbackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
In my case, I forgot to initialize the variable rq, please, make sure you did it
...
private RequestQueue rq; // rq = null (NullPointerException if you use it)
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
rq = Volley.newRequestQueue(YourActivity.this); // rq != null
}
...
rq.add(request);
You didn't pass any data to the volley method, that means it get null data (empty data)..... see example:
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> map=new HashMap<>();
map.put(region, regionName);
return map;
}
if regionName is empty it will give you NullPointerException, so regionName must have something.....
As N1to says, you need to add your controller in the AndroidManifest.xml, if you don't add it then the onCreate() is never called and when you call AppController.getInstance() the instance is null.
<application android:name="YOURPACKAGENAME.AppController"
android:allowbackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
It also works for me with:
<application android:name=".AppController"
android:allowbackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">