Skipped 32 Frames! The Application May Be Doing Too Much Work On Its Main Thread And Then Fatal Exception: Main
I am new to android programming. I am developing an android app. DashboardGridActivity is a main activity. This activity should show grid view on launching of this app. Following
Solution 1:
your field context
in your DashboardAdapter
is null
you should make sure you assign it in your constructor, like this:
ContextmContext=null;
DashboardAdapter(Context context)
{
mContext = context;
dashboardImages = newArrayList<DashboardItems>();
Resourcesres= context.getResources();
String[] tempDashItems = res.getStringArray(R.array.dashboard_names);
int[] dashImages = {R.drawable.apartments, R.drawable.atms, R.drawable.banks, R.drawable.book_stores, R.drawable.car_rentals, R.drawable.furniture_shops, R.drawable.gas_stations, R.drawable.gyms, R.drawable.malls, R.drawable.mobile_shops, R.drawable.pharmacy, R.drawable.pizza_places, R.drawable.postal_services, R.drawable.restaurants, R.drawable.subs_burgers, R.drawable.supermarkets, R.drawable.theatres};
for(int i=0;i<10;i++)
{
DashboardItemstempDash=newDashboardItems(dashImages[i],tempDashItems[i]);
dashboardImages.add(tempDash);
}
}
Note: I have renamed the field context
to mContext
so it is more obvious that it is a member field, and so it won't be hidden by the method argument
Post a Comment for "Skipped 32 Frames! The Application May Be Doing Too Much Work On Its Main Thread And Then Fatal Exception: Main"