Trying to set custom font on TextView - nullpointer - android

I have no underlined code, but as soon as i start my app on emulator, i'm receiving these errors.
FATAL EXCEPTION: main
Process: com.milos.sportisa, PID: 2735
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.milos.sportisa/com.milos.sportisa.SplashActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setTypeface(android.graphics.Typeface)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setTypeface(android.graphics.Typeface)' on a null object reference
at com.milos.sportisa.SplashActivity.onCreate(SplashActivity.java:29)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
at android.app.ActivityThread.access$800(ActivityThread.java:144) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5221) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
 
And this is my SplashActivity:
public class SplashActivity extends AppCompatActivity {
private TextView etSportisa;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
/* ButterKnife.inject(this);
mProgressBar.setIndeterminateDrawable(new foldingCirclesDrawable.Builder(this)
.build());
mProgressBar.setIndeterminateDrawable(new foldingCirclesDrawable.Builder(this)
.colors(getResources().getIntArray(R.array.colors) //Array of 4 colors
.build()); */
Typeface myTypeFace = Typeface.createFromAsset(getAssets(), "fonts/esp_ital.ttf");
etSportisa.setTypeface(myTypeFace);
etSportisa = (TextView) findViewById(R.id.tv_sportisa);
final ProgressDialog pd = new ProgressDialog(SplashActivity.this);
pd.setMessage("Učitavanje...");
pd.show();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
// Actions to do after 10 seconds
pd.dismiss();
Intent i = new Intent(SplashActivity.this, MainActivity.class);
startActivity(i);
}
}, 2000);
}
}
Special font is added in assets\font folder. I also added an image for the loading screen but i think that the font is cousin those issues

Make the following changes to your code:
Typeface myTypeFace = Typeface.createFromAsset(getAssets(), "fonts/esp_ital.ttf");
etSportisa = (TextView) findViewById(R.id.tv_sportisa);
etSportisa.setTypeface(myTypeFace);
After initialization, you can do any operation with any layout.

The problem is here:
etSportisa is null
set it after you findViewByID
Typeface myTypeFace = Typeface.createFromAsset(getAssets(), "fonts/esp_ital.ttf");
etSportisa = (TextView) findViewById(R.id.tv_sportisa);
etSportisa.setTypeface(myTypeFace);

Related

Ormlite in a IntentService

I'm working with OrmLite but I get an exception when I'm trying to use it into a IntentService:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: fr.solutis.solutis, PID: 29456
java.lang.RuntimeException: Unable to instantiate service fr.solutis.solutis.notifications.NotificationDemandeService:
java.lang.NullPointerException: Attempt to invoke virtual method
'android.content.res.Resources android.content.Context.getResources()'
on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3148)
at android.app.ActivityThread.access$1900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1513)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5910)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources
android.content.Context.getResources()' on a null object reference
at android.content.ContextWrapper.getResources(ContextWrapper.java:86)
at com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper.openFileId(OrmLiteSqliteOpenHelper.java:310)
at com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper.(OrmLiteSqliteOpenHelper.java:76)
at fr.solutis.solutis.helpers.DatabaseHelper.(DatabaseHelper.java:56)
at fr.solutis.solutis.notifications.NotificationDemandeService.(NotificationDemandeService.java:25)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1690)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3145)
at android.app.ActivityThread.access$1900(ActivityThread.java:177) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1513) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5910) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
code:
public class NotificationDemandeService extends IntentService {
DatabaseHelper db = new DatabaseHelper(NotificationDemandeService.this);
Boolean isInternetPresent = false;
Boolean isUrlAvailable = false;
ConnectionDetector cd;
String message = "";
public NotificationDemandeService() {
super("EnvoieService");
}
#Override
protected void onHandleIntent(Intent intent) {
try {
List<Demandes> demandes = db.getAllDemandesRenvoie();
...
} catch (SQLException e) {
e.printStackTrace();
}
....
}
}
just by calling:
DatabaseHelper db = new DatabaseHelper(this);
after:
#Override
protected void onHandleIntent(Intent intent)
Gonna work, I don't understand the issue, but it works !

SimpleAdapter crashes every second launch time

I have a SimpleAdapter with filtering inputSearch and clickable items (which I get from MySQL database).
Sometimes when I lunch my project there is an error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.brzozowski.marcin.inzynierka/com.brzozowski.marcin.inzynierka.activities.ChooseGroupActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.widget.Filter android.widget.SimpleAdapter.getFilter()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3947)
at android.app.ActivityThread.access$900(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.widget.Filter android.widget.SimpleAdapter.getFilter()' on a null object reference
at com.brzozowski.marcin.inzynierka.activities.ChooseGroupActivity$2.onTextChanged(ChooseGroupActivity.java:103)
at android.widget.TextView.sendOnTextChanged(TextView.java:7679)
at android.widget.TextView.setText(TextView.java:4060)
at android.widget.TextView.setText(TextView.java:3915)
at android.widget.EditText.setText(EditText.java:85)
at android.widget.TextView.setText(TextView.java:3890)
at android.widget.TextView.onRestoreInstanceState(TextView.java:3790)
at android.view.View.dispatchRestoreInstanceState(View.java:13740)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2893)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2893)
at android.view.View.restoreHierarchyState(View.java:13718)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2009)
at android.app.Activity.onRestoreInstanceState(Activity.java:1023)
at android.app.ListActivity.onRestoreInstanceState(ListActivity.java:219)
at android.app.Activity.performRestoreInstanceState(Activity.java:978)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1162)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3947) 
at android.app.ActivityThread.access$900(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
When I launch the application next time, its ok.
So the error occurs every second launch.
Remove simpleAdapter initialization from onResume.
In your onCreate
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initAdapter();
}
private void initAdapter(){
simpleAdapter = new SimpleAdapter(this, employeeList,
android.R.layout.simple_list_item_1,
new String[] { "groups" }, new int[] { android.R.id.text1 });
listView.setAdapter(simpleAdapter);}
#Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(simpleAdapter == null){
initAdapter();
}
simpleAdapter.getFilter().filter(s);
}
You create the SimpleAdapter in onResume, but what's happening here is that you have set your textChangedListener in onCreate. After onCreate is called, Android restores the view state, including the text in your view. This triggers the text change listener before onResume runs and creates the SimpleAdapter. I think you will be fine to move your SimpleAdapter setup to onCreate, and then it should just work.

cant use ActionBar methods in android studio

I am trying to set some things to the action bar but i get the same errors on any method i use for it (e.g actionBar.setTitle("my title"); or actionBar.setBackgroundDrawable(R.drawable.actionbar_draw);)
i cant even use the get methods for it...
they all give this error:
required android.support.v7.app.ActionBar but found android.app.ActionBar
i am using minimum sdk 15 and this is my code:
package com.tos.test.testactionbarapp;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionBar = getActionBar();
actionBar.setTitle("my title");
}
}
problem is, my app crashes whenever i start it because of this code and i get:
---
------ beginning of crash
05-28 15:32:00.403 11476-11476/ccom.tos.test.testactionbarapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tos.test.testactionbarapp, PID: 11476
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tos.test.testactionbarapp/com.tos.test.testactionbarapp.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.app.ActionBar.getTitle()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.app.ActionBar.getTitle()' on a null object reference
at com.tos.test.testactionbarapp.MainActivity.onCreate(MainActivity.java:21)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
you have to import android.support.v7.app.ActionBar and use getSupportActionBar() method od activity.
Change
getActionBar();
to
getSupportActionBar();
Try it!!
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionBar = getSupportActionBar();
actionBar.setTitle("my title");
}
Just Do this
ActionBar actionBar = getSupportActionBar();
instead of
ActionBar actionBar = getActionBar();

Android app null error

I am creating a restaurant app that requires an expandable listview to show a menu for the waiter to take a customer's menu. The app is crashing and I think it has something to do with the code below:
public class Menu extends AppCompatActivity {
HashMap < String, List < String >> Food_menu;
List < String > Food_list;
ExpandableListView Exp_list;
FoodMenuAdapter adapter;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Exp_list = (ExpandableListView) findViewById(R.id.exp_list);
Food_menu = DataProvider.getInfo();
Food_list = new ArrayList < String > (Food_menu.keySet());
adapter = new FoodMenuAdapter(this, Food_menu, Food_list);
Exp_list.setAdapter(adapter);
}
}
When I debugged the app, it said that:
Exp_list
Food_menu
Food_list
were all coming back as null. I'm new to android studios and I'm not sure how to remedy the problem. Any help would be greatly appreciated, thanks.
Logcat:
04-11 22:05:53.841 1960-1960/com.example.ben.restaurantapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ben.restaurantapp, PID: 1960
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ben.restaurantapp/com.example.ben.restaurantapp.Menu}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ExpandableListView.setAdapter(android.widget.ExpandableListAdapter)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ExpandableListView.setAdapter(android.widget.ExpandableListAdapter)' on a null object reference
at com.example.ben.restaurantapp.Menu.onCreate(Menu.java:38)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
at android.app.ActivityThread.access$800(ActivityThread.java:144) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5221) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
I think the second parameter of your FoodMenuAdapter has to be a resource layout file.
For example:
Food Food_menu = DataProvider.getInfo();
adapter = new FoodMenuAdapter(this, R.layout.your_xml_layout_here, Food_list);
Exp_list = (ExapandableListView) findViewById(R.id.exp_list);
Exp_list.setAdapter(adapter);
Where your_xml_layout_here is the layout that all the information will be displayed on. Keep in mind that an adapter is the middleman of information and what you see on your application screen.
From your logcat you can see the exact problem:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ExpandableListView.setAdapter(android.widget.ExpandableListAdapter)' on a null object reference
which means that at the point you try to use setAdapter method on the Exp_List, the said variable is null.
What you can do from here on is to check if your layout activity_main actually contains an ExpandableListView with an id of exp_list (maybe post your layout?).
Your question should not be android studio null error as the null has nothing to do with Android Studio - it comes from the programming language, in this specific case - Java.
You can learn how to fix NullPointerExceptions here.

The viewpager in a fragment

I want do some slides in my app, in the activity, the following code works fine, but in the fragment, the app crash and say something like "java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.view.ViewPager.setAdapter(android.support.v4.view.PagerAdapter)' on a null object reference", how can I fix this?
The code in an activity:
private ViewPager frViewPager;
private int[] frImgIds = new int[]{R.drawable.pic_1,R.drawable.pic_2,R.drawable.pic_3};
private List<ImageView> mImages = new ArrayList<ImageView>();
frViewPager = (ViewPager) findViewById(R.id.landing_page);
frViewPager.setAdapter(new PagerAdapter() {
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = new ImageView(LandingPageActivity.this);
imageView.setImageResource(frImgIds[position]);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
container.addView(imageView);
mImages.add(imageView);
return imageView;
}
/* Other override code……*/
})
The code in a fragment:
private ViewPager frViewPager;
private int[] frImgIds = new int[]{R.drawable.pic_1,R.drawable.pic_2,R.drawable.pic_3};
private List<ImageView> mImages = new ArrayList<ImageView>();
frViewPager = (ViewPager) this.getActivity().findViewById(R.id.recommend);
frViewPager.setAdapter(new PagerAdapter() {
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = new ImageView(getActivity());
imageView.setImageResource(frImgIds[position]);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
container.addView(imageView);
mImages.add(imageView);
return imageView;
}
/* Other override code……*/
})
Update:
04-16 02:04:33.951 1996-1996/com.demo.example E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.demo.example, PID: 1996
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.demo.example/com.demo.android.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.view.ViewPager.setAdapter(android.support.v4.view.PagerAdapter)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.view.ViewPager.setAdapter(android.support.v4.view.PagerAdapter)' on a null object reference
at com.demo.android.fragment.IndexFragment.onCreateView(IndexFragment.java:32)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:953)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1136)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1499)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:548)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)
at android.app.Activity.performStart(Activity.java:5953)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
It should be frViewPager = (ViewPager) view.findViewById(R.id.recommend);

Categories

Resources