I'm having some issues when I am running my method. How can I get it working so my mock locations will work on my actual device. (Ps. I've included permissions).
This provides a null pointer exception and I am not to sure why?
Method:
private void setMockLocation() {
{
Context context = null;
LocationManager locationManager = (LocationManager)context.getSystemService( Context.LOCATION_SERVICE );
Criteria criteria = new Criteria();
criteria.setAccuracy( Criteria.ACCURACY_COARSE );
String provider = locationManager.getBestProvider( criteria, true );
if ( provider == null ) {
Log.e( TAG, "No location provider found!" );
return;
}
locationManager.getLastKnownLocation(provider);
Location newLocation = new Location(LocationManager.GPS_PROVIDER);
newLocation.setLatitude(55.9500);
newLocation.setLongitude(3.1833);
newLocation.setAccuracy(500);
mLocationManager.setTestProviderEnabled
(
LocationManager.GPS_PROVIDER,
true
);
mLocationManager.setTestProviderStatus
(
LocationManager.GPS_PROVIDER,
LocationProvider.AVAILABLE,
null,
System.currentTimeMillis()
);
mLocationManager.setTestProviderLocation
(
LocationManager.GPS_PROVIDER,
newLocation
);
}
}
Stack Trace:
05-10 18:50:46.218 14398-14398/com.example.ankhit.saveme E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
at com.example.ankhit.saveme.UserLocation.setMockLocation(UserLocation.java:220)
at com.example.ankhit.saveme.UserLocation.access$000(UserLocation.java:42)
at com.example.ankhit.saveme.UserLocation$4.onClick(UserLocation.java:175)
at android.view.View.performClick(View.java:4439)
at android.view.View$PerformClick.run(View.java:18398)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
However, when I add the code below to Context context code shown above I get a 'GPS Provider Unknown' Error
LocationManager locationManager = (LocationManager)context.getSystemService( Context.LOCATION_SERVICE );
Criteria criteria = new Criteria();
criteria.setAccuracy( Criteria.ACCURACY_COARSE );
String provider = locationManager.getBestProvider( criteria, true );
if ( provider == null ) {
Log.e( TAG, "No location provider found!" );
return;
}
lastLocation = locationManager.getLastKnownLocation(provider);
StackTrace:
05-10 18:54:37.395 15159-15159/com.example.ankhit.saveme E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalArgumentException: Provider "gps" unknown
at android.os.Parcel.readException(Parcel.java:1429)
at android.os.Parcel.readException(Parcel.java:1379)
at android.location.ILocationManager$Stub$Proxy.removeTestProvider(ILocationManager.java:956)
at android.location.LocationManager.removeTestProvider(LocationManager.java:1194)
at com.example.ankhit.saveme.UserLocation.setMockLocation(UserLocation.java:218)
at com.example.ankhit.saveme.UserLocation.access$000(UserLocation.java:42)
at com.example.ankhit.saveme.UserLocation$4.onClick(UserLocation.java:175)
at android.view.View.performClick(View.java:4439)
at android.view.View$PerformClick.run(View.java:18398)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Any Ideas?
The NullPointerException should come from
Context context = null;
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE );
because context is null and you invoke a method on it.
Related
When i am trying to display the contacts in card view when i click on Button it shows fatal exception error it doesnot display cardview anyone can solve this programming with brillliance and another error is it show only one cardview when i click on again the app will be strucked?
Showcontacts.java
public class ShowContacts extends Activity
{
private SQLiteDatabase db;
DbOperations doo;
private List<Contacts> contactsList;
private RecyclerView rv;
private Cursor c;
String names,email,address;
int phone;
String read_query = "select * from"+ ContactsTask.ContactsEntry.TABLE_NAME;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recycle_layout);
doo = new DbOperations(this);
openDatabase();
rv = (RecyclerView)findViewById(R.id.recyclerview);
initializeData();
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
rv.setLayoutManager(linearLayoutManager);
rv.setHasFixedSize(true);
ContactAdapter cc = new ContactAdapter(contactsList);
rv.setAdapter(cc);
}
public void initializeData() {
contactsList = new ArrayList<>();
c = db.rawQuery(read_query,null);
c.moveToFirst();
while (!c.isLast())
{
names = c.getString(0);
phone = c.getInt(1);
email = c.getString(2);
address = c.getString(3);
contactsList.add(new Contacts(names,phone,email,address));
}
c.isLast();
names = c.getString(0);
phone = c.getInt(1);
email = c.getString(2);
address = c.getString(3);
contactsList.add(new Contacts(names,phone,email,address));
}
private void openDatabase() {
db = openOrCreateDatabase("contactDB", Context.MODE_PRIVATE,null);
}
}
Logacat error
06-28 08:57:43.107 568-568/com.example.anilkumar.contactstask E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.anilkumar.contactstask/com.example.anilkumar.contactstask.ShowContacts}: android.database.sqlite.SQLiteException: near "fromcontacts": syntax error: , while compiling: select * fromcontacts
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteException: near "fromcontacts": syntax error: , while compiling: select * fromcontacts
at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:127)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1564)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1538)
at com.example.anilkumar.contactstask.ShowContacts.initializeData(ShowContacts.java:44)
at com.example.anilkumar.contactstask.ShowContacts.onCreate(ShowContacts.java:34)
at android.app.Activity.performCreate(Activity.java:4466)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
Another logact error
06-28 13:14:40.552 11252-11261/com.example.anilkumar.contactstask E/SQLiteDatabase: close() was never explicitly called on database '/data/data/com.example.anilkumar.contactstask/databases/contactDB'
android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1943)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:986)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:962)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1043)
at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1036)
at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:761)
at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:215)
at com.example.anilkumar.contactstask.ShowContacts.openDatabase(ShowContacts.java:66)
at com.example.anilkumar.contactstask.ShowContacts.onCreate(ShowContacts.java:33)
at android.app.Activity.performCreate(Activity.java:4466)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
Just update
String read_query = "select * from"+ ContactsTask.ContactsEntry.TABLE_NAME;
to
String read_query = "select * from "+ ContactsTask.ContactsEntry.TABLE_NAME;
Always close cursor. update your initializeData method
public void initializeData() {
try {
contactsList = new ArrayList<>();
try{
c = db.rawQuery(read_query,null);
c.moveToFirst();
while (!c.isLast())
{
names = c.getString(0);
phone = c.getInt(1);
email = c.getString(2);
address = c.getString(3);
contactsList.add(new Contacts(names,phone,email,address));
}
c.isLast();
names = c.getString(0);
phone = c.getInt(1);
email = c.getString(2);
address = c.getString(3);
contactsList.add(new Contacts(names,phone,email,address));
} catch (Exception e) {
// exception handling
} finally {
if(c != null){
c.close();
}
}
}
My code on getting current location is working when I'm using map fragment, but when I use it in another class without displaying the map, I'm getting nullpointerException in String provider. Can you please check what's wrong with my program and if possible explain why I'm getting this error.
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View v = inflater
.inflate(R.layout.layout_school_list, container, false);
lvList = (ListView) v.findViewById(R.id.lvSchools);
LocationManager locationManager = (LocationManager) getSystemService("location");
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
final Location currentLoc = locationManager
.getLastKnownLocation(provider);
if (currentLoc != null) {
onLocationChanged(currentLoc);
}
if (Distance==true){
double lat = currentLoc.getLatitude();
double lng = currentLoc.getLongitude();
ArrayList<Double> rangeList = getRangeList(lat, lng);
ArrayList<String> theList1 = new ArrayList<String>();
for (int count = 0; count < rangeList.size(); count++)
{
String temp = sTuition[count];
theTuitionFee = Integer.parseInt(temp);
for(int subloop=0; subloop<sSpecialty[count].length; subloop++) {
List<String> values = (List<String>)thisFilter[4];
if (rangeList.get(count) <= DistanceVal
&&sReg[count].equalsIgnoreCase((String)thisFilter[0])
&& sAdmin[count].equalsIgnoreCase((String)thisFilter[1])
&& sAmbience[count].equalsIgnoreCase((String)thisFilter[3])
&& amountTF >= theTuitionFee
&& filtered(sSpecialty[count][subloop], values)) {
theList1.add(sList[count]);
}
}
}
displayNearbyList(theList1);
}
Here's my methods:
public void onLocationChanged(Location location) {
double currentLat = location.getLatitude();
double currentLng = location.getLongitude();
}
And also getting error with getSystemService and my IDE requires me to put this
private LocationManager getSystemService(String string) {
// TODO Auto-generated method stub
return null;
}
which is not used in my other working class.
Here's my stack trace . I'm new here , so I don't know how to post stack trace properly
08-29 12:14:45.017: E/AndroidRuntime(6864): FATAL EXCEPTION: main
08-29 12:14:45.017: E/AndroidRuntime(6864): java.lang.NullPointerException
08-29 12:14:45.017: E/AndroidRuntime(6864): at capstone.app.recommender.SchoolListFragmentFilter.onCreateView(SchoolListFragmentFilter.java:67)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.os.Handler.handleCallback(Handler.java:725)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.os.Handler.dispatchMessage(Handler.java:92)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.os.Looper.loop(Looper.java:137)
08-29 12:14:45.017: E/AndroidRuntime(6864): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-29 12:14:45.017: E/AndroidRuntime(6864): at java.lang.reflect.Method.invokeNative(Native Method)
08-29 12:14:45.017: E/AndroidRuntime(6864): at java.lang.reflect.Method.invoke(Method.java:511)
08-29 12:14:45.017: E/AndroidRuntime(6864): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-29 12:14:45.017: E/AndroidRuntime(6864): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-29 12:14:45.017: E/AndroidRuntime(6864): at dalvik.system.NativeStart.main(Native Method)
You should replace your line
LocationManager locationManager = (LocationManager) getSystemService("location");
With this one
LocationManager locationManager = (LocationManager)<your context>.getSystemService(Context.LOCATION_SERVICE);
private LocationManager getSystemService(String string) {
// TODO Auto-generated method stub
return null;
}
This is the method you have to imlpement by yourself, as you return null. the locationManager below is null, and therefore throws NullPointerException
String provider = locationManager.getBestProvider(criteria, true);
check the post below to know how should you implement getSystemService()
How does getSystemService() work exactly?
I'm trying to set my mock location however, I am getting the following error(Provider 'gps' unknown) and not to sure what is wrong?
I've got all the permission declared in my manifest.xml along with all the parameters.
Mock Location Method
//Initiates the method to set the phones location
private void setMockLocation() {
mLocationManager.removeTestProvider(LocationManager.GPS_PROVIDER);
mLocationManager.addTestProvider
(
LocationManager.GPS_PROVIDER,
"requiresNetwork" == "",
"requiresSatellite" == "",
"requiresCell" == "",
"hasMonetaryCost" == "",
"supportsAltitude" == "",
"supportsSpeed" == "",
"supportsBearing" == "",
android.location.Criteria.POWER_LOW,
android.location.Criteria.ACCURACY_FINE
);
Location newLocation = new Location(LocationManager.GPS_PROVIDER);
newLocation.setLatitude (32.4276462);
newLocation.setLongitude(-23.5509257);
newLocation.setAccuracy(500);
mLocationManager.setTestProviderEnabled
(
LocationManager.GPS_PROVIDER,
true
);
mLocationManager.setTestProviderStatus
(
LocationManager.GPS_PROVIDER,
LocationProvider.AVAILABLE,
null,
System.currentTimeMillis()
);
mLocationManager.setTestProviderLocation
(
LocationManager.GPS_PROVIDER,
newLocation
);
}
Error message
5-09 16:28:45.577 9070-9070/com.example.ankhit.saveme E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalArgumentException: Provider "gps" unknown
at android.os.Parcel.readException(Parcel.java:1429)
at android.os.Parcel.readException(Parcel.java:1379)
at android.location.ILocationManager$Stub$Proxy.removeTestProvider(ILocationManager.java:956)
at android.location.LocationManager.removeTestProvider(LocationManager.java:1194)
at com.example.ankhit.saveme.UserLocation.setMockLocation(UserLocation.java:215)
at com.example.ankhit.saveme.UserLocation.access$000(UserLocation.java:41)
at com.example.ankhit.saveme.UserLocation$4.onClick(UserLocation.java:173)
at android.view.View.performClick(View.java:4439)
at android.view.View$PerformClick.run(View.java:18398)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Any ideas?
I want to refresh data in ListFragment from my custom adapter class, but got the error NullPointerException.
This is Adaper class method:
b1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
BasketFragment basketFragment = new BasketFragment();
basketFragment.getBsketList();
}
});
And when I call it in my Fragment class I get java.lang.NullPointerException at mDataBase = dbHelper.getWritableDatabase();
getBasketList():
public void refreshList() {
dbAdaper.setArrayMyData(selectAll());
dbAdaper.notifyDataSetChanged();
}
And here is the part where I got the error:
public ArrayList<BasketData> selectAll() {
Cursor mCursor = null;
dbHelper = new DBHelper(getActivity());
mDataBase = dbHelper.getWritableDatabase();//NullPointerException
mCursor = mDataBase.query("orderTable", null, null, null, null, null, null);
LogCat:
java.lang.NullPointerException
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
at com.epon.fragments.BasketFragment.selectAll(BasketFragment.java:100)
at com.epon.fragments.BasketFragment.getBsketList(BasketFragment.java:142)
at com.epon.adapters.DBBasketAdapter$2.onClick(DBBasketAdapter.java:177)
at android.view.View.performClick(View.java:4240)
at android.view.View$PerformClick.run(View.java:17721)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Have you set the context right?
Android: NullPointerException on getWritableDatabase()
NullPointerException on getWritableDatabase()
I think that his is your problem a problem.
Maybe if this is not helping posting the content of getActivity() might be helpful?
edit
Your logcat makes me keep thinking that its a context error!
I am currently working on the new Google Maps Android API v2.
My MapActivity class is working with my Samsung galaxy s3 ans s2 with the code below:
However, there are some particular devices are not working such as: GT-S5830i
class MapActivity extends FragmentActivity implements OnMapClickListener, OnMapLongClickListener, OnMarkerClickListener
{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
tvLocInfo = (TextView)findViewById(R.id.locinfo);
android.support.v4.app.FragmentManager myFragmentManager = getSupportFragmentManager();
SupportMapFragment myMapFragment = (SupportMapFragment)myFragmentManager.findFragmentById(R.id.map);
myMap = myMapFragment.getMap();
myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
ArrayList<Cooridnates> cooridnatesList = MainActivity.getList();
for(int i=0;i<cooridnatesList.size();i++)
{
//Toast.makeText(MapActivity.this, "SIZE : " + " " + cooridnatesList.size(), Toast.LENGTH_LONG).show();
LatLng point = new LatLng(cooridnatesList.get(i).getLat(),cooridnatesList.get(i).getLon());
tvLocInfo.setText("markers added");
myMap.addMarker(new MarkerOptions().position(point).title(point.toString()));
center=CameraUpdateFactory.newLatLng(point);
}
CameraUpdate zoom=CameraUpdateFactory.zoomTo(16);
myMap.moveCamera(center);
myMap.animateCamera(zoom);
myMap.setOnMapClickListener(this);
myMap.setOnMarkerClickListener(this);
markerClicked = false;
}
For some reason, I am getting this error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.coldice.plotfinder/com.coldice.plotfinder.MapActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.google.android.gms.maps.GoogleMap.moveCamera(Unknown Source)
at com.coldice.plotfinder.MapActivity.onCreate(MapActivity.java:70)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
... 11 more
You function MainActivity.getList() probably returned an empty list, so for loop doesn't execute center=CameraUpdateFactory.newLatLng(point);.
it seems center is null in this >> myMap.moveCamera(center);, make an appropriate check on this variable before passing it in moveCamera method.
It seems problem is here. center might have null value, So to get proper explanation debug your application.
center is initialzed here.
center=CameraUpdateFactory.newLatLng(point);
It might assign null in center.
myMap.moveCamera(center); <<<PROBLEM is here
if(center != null )
myMap.moveCamera(center);