Communicating with fragment NullPointerException [duplicate] - android

This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 5 years ago.
I'm very new to Android UI, I've been looking for a place I can learn the basic structure of UI and how communication and layouts should work. But regardless. My problem comes from me trying to change the value of a TextView within a fragment. I keep getting a nullPointerException when i try to change the value. I am using a fragment manager to refer to the fragment.
Here's the fragment code:
package com.archronix.infotainment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class Fragment1 extends android.support.v4.app.Fragment {
public TextView status;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_fragment1, container,
false);
return v;
}
public static Fragment1 newInstance() {
Fragment1 f = new Fragment1();
return f;
}
public void postText(String str){
status.setText(status.getText()+"\n"+str);
}
}
And this is how i declare my fragment manager:
fragment1 = (Fragment1)
getSupportFragmentManager().findFragmentById(R.id.fragment1);
And, how I use it:
fragment1.postText("testtext");
My logcat:
05-15 10:56:42.406 4109-4109/com.archronix.infotainment E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.archronix.infotainment, PID: 4109
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.archronix.infotainment/com.archronix.infotainment.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.archronix.infotainment.Fragment1.postText(java.lang.String)' 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 com.archronix.infotainment.Fragment1.postText(java.lang.String)' on a null object reference
at com.archronix.infotainment.MainActivity.onCreate(MainActivity.java:102)
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) 
Apologies for my newbieness. I've read 20 stack overflow posts regarding similar topics but all seem to be either outdated or not consistent. What is the best way to accomplish my task? Thank you.

status variable is not assigned to any textview.
Add the following code in onCreateView before return statement
status=v.findViewById(R.id.<nameoftextview>);

In onCreateView you should initialize your TextView like so:
status = (TextView) v.findViewById(R.id.tv_status);
If you know the text that you want to set before the FragmentTransaction you can use a Bundle (How to transfer some data to another Fragment?)

Related

Android Checkbox error "on a null object reference" [duplicate]

This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 4 years ago.
I tried to make a checkbox that when it is checked it will strikethrough text field elements in the listview. I'm pretty sure that I did everything correctly including set up the ID for the checkbox in XML and declared it on the class that I wanna use but I still get the Null object error.
I have looked through all the question and answer all over this topic, I also tried them all but I still get an error. Could someone please help me identify where an error might be.
Thank you so much in advance for any help =)
Class file
package com.puyakul.prin.psychic_shopping;
import...
public class MainListView extends AppCompatActivity {
//================DATABASE=====================//
private ShoppingListDatabase databaseConnection;
private SQLiteDatabase db;
public ListView ListView_mainListView;
public ArrayList<ShoppingList> lists;
public AppCompatCheckBox checkBox_doneCheck;
public TextView textView_listname;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//================DATABASE Connection================//
databaseConnection = new ShoppingListDatabase(this);
db = databaseConnection.open();
//important!!!
setContentView(R.layout.activity_main_list_view);
getLists();
}
public void getLists(){
....
******Original here, but I delete by acident******
checkBox_doneCheck = findViewById(R.id.checkBox_doneCheck);
checkBox_doneCheck.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
#Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (checkBox_doneCheck.isChecked()) {
textView_listname.setPaintFlags(textView_listname.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
}
else{
textView_listname.setPaintFlags(textView_listname.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
}
}
});
}
XML file
<android.support.v7.widget.AppCompatCheckBox
android:id="#+id/checkBox_doneCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:checked="false"/>
Error log
Process: com.puyakul.prin.psychic_shopping, PID: 19958
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.puyakul.prin.psychic_shopping/com.puyakul.prin.psychic_shopping.MainListView}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.AppCompatCheckBox.setOnCheckedChangeListener(android.widget.CompoundButton$OnCheckedChangeListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.AppCompatCheckBox.setOnCheckedChangeListener(android.widget.CompoundButton$OnCheckedChangeListener)' on a null object reference
at com.puyakul.prin.psychic_shopping.MainListView.getLists(MainListView.java:107)
at com.puyakul.prin.psychic_shopping.MainListView.onCreate(MainListView.java:67)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 
You never initialize checkBox_doneCheck, try this instead in onCreate:
setContentView(R.layout.activity_main_list_view);
checkBox_doneCheck = (AppCompatCheckBox) findViewById(R.id.checkBox_doneCheck);
getLists();
You may also want to do something similar with those variables:
ListView_mainListView
textView_listnameist item
You are missing the association between the xml and java code.
Add this line:
checkBox_doneCheck = findViewById(R.id.checkBox_doneCheck)
Thats why you are having the NullPointerException.

App stops running after setting tablayout with ViewPager

I created my own TabLayout menu (from an empty Activity) with a modified SectionPagerAdapter from a TabActivity project. I only changed the getItem() method and removed the page title method.
public Fragment getItem(int position) {
switch (position)
{
case 0:
HomeActivity home = new HomeActivity();
return home;
case 1:
PayActivity pay = new PayActivity();
return pay;
case 2:
VideoActivity video = new VideoActivity();
return video;
case 3:
BillActivity bill = new BillActivity();
return bill;
default:
return null;
}
}
}
And after the execution of
TabLayout tabToolbar = (TabLayout) findViewById(R.id.tabToolbar);
ViewPager viewPager = (ViewPager) findViewById(R.id.container);
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mSectionsPagerAdapter);
tabToolbar.setupWithViewPager(viewPager);
my App has been stopped.
If I comment
tabToolbar.setupWithViewPager(viewPager);
than my menu doesn't work but I can swipe between my fragments within the ViewPager.
I want to swipe with my menu button and by swipping with my mousecursor as well.
If you need some more information or resources please let me know.
Edit:
The error log shows:
09-08 06:19:05.822 4207-4207/com.example.fdai3744.t_online20 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.fdai3744.t_online20, PID: 4207
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fdai3744.t_online20/com.example.fdai3744.t_online20.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setColorFilter(int, android.graphics.PorterDuff$Mode)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setColorFilter(int, android.graphics.PorterDuff$Mode)' on a null object reference
at com.example.fdai3744.t_online20.MainActivity.onCreate(MainActivity.java:37)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
2nd edit:
I found out that my adapter has no "public CharSequence getPageTitle(int position)" method.
add this line of code below setupwithviewpager;
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabtoolbar));
EDIT :
i have updated the answer , you can refer this answer for tabs with icons only.
https://stackoverflow.com/a/32173670/5339829

getSupportFragmentManager().getFragments() works, but not findFragmentByTag("name");

I'm simply trying to run a method within a fragment from my main activity. getFragments() lists all the fragments in my application correctly. However when calling findFragmentByTag() the result is always null! I've looked around and no solution seems to help.
Here's where I call my fragment manager
fm.executePendingTransactions();
Log.d("Fragmento", fm.getFragments().toString());
Log.d("Fragmento", fm.findFragmentByTag("frag3").toString());
where fm is
`FragmentManager fm = getSupportFragmentManager();`
My fragment Code is
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class Fragment3 extends Fragment {
TextView status;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment3, container, false);
Log.d("InFragment", this.getClass().toString());
return v;
}
public static Fragment3 newInstance() {
Fragment3 f = new Fragment3();
return f;
}
public void setStatus(String msg){
status = (TextView)getView().findViewById(R.id.canLog);
status.setText(status.getText()+"\n"+msg);
}
}
My layout is very simple, and i've defined an ID and a tag within the layout for the fragment.
`<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:tag="frag3"
android:id="#+id/fragment3">
</LinearLayout>`
finally my error log
05-25 16:56:54.949 13263-13263/com.archronix.infotainment E/AndroidRuntime:
FATAL EXCEPTION: main
Process: com.archronix.infotainment, PID: 13263
java.lang.IllegalStateException: Could not execute method for
android:onClick
at android.view.View$DeclaredOnClickListener.onClick(View.java:4458)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21155)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.view.View$DeclaredOnClickListener.onClick(View.java:4453)
at android.view.View.performClick(View.java:5204) 
at android.view.View$PerformClick.run(View.java:21155) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5422) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String android.support.v4.app.Fragment.toString()' on a null
object reference
at
com.archronix.infotainment.MainActivity.buttonClicked(MainActivity.java:445)
at java.lang.reflect.Method.invoke(Native Method) 
at android.view.View$DeclaredOnClickListener.onClick(View.java:4453) 
at android.view.View.performClick(View.java:5204) 
at android.view.View$PerformClick.run(View.java:21155) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5422) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
This is probably a very stupid question however fragments seem to baffle me completely.
Problem:
Setting the tag in the LinearLayout doesn't work, the Fragmentmangager wont find it
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:tag="frag3" <-- not good
android:id="#+id/fragment3">
`
Solution:
If your define the fragment in the xml:
<fragment android:name="com.example.YourFragment"
android:id="#+id/frag3Id"
android:layout_width="match_parent"
android:tag="frag3"
android:layout_height="match_parent" />
you can find it with:
fm.findFragmentByTag("frag3")
or
fm.findFragmentById(R.id.frag3Id)
Or you can set the tag withe the add and replace functions of the FragmentTransaction

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.

Unable to start activity ComponentInfo - Android App

New to Android. Not sure how many method I am supposed to upload, so I will upload the just method with the error.
I am following a book Android Application Development for Dummies 3rd edition, but getting an error even though I checked for code discrepancies.
Here is the method.
package com.dan190.tasks.activity;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toolbar;
import com.dan190.tasks.R;
import com.dan190.tasks.fragment.TaskEditFragment;
public class TaskEditActivity extends Activity {
public static final String EXTRA_TASKID = "taskId";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_task_edit);
setActionBar((Toolbar) findViewById(R.id.toolbar));
long id = getIntent().getLongExtra(TaskEditActivity.EXTRA_TASKID, 0L);
Fragment fragment = TaskEditFragment.newInstance(id);
String fragment_tag = TaskEditFragment.DEFAULT_FRAGMENT_TAG;
/** This part below is where the bug happens
** If I comment this part out, app still runs
**/
if (savedInstanceState == null) {
getFragmentManager().beginTransaction().add(
R.id.container,
fragment,
fragment_tag).commit();
}
}
}
Here is the error
07-17 11:52:47.110 29969-29969/com.dan190.tasks E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.dan190.tasks, PID: 29969
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dan190.tasks/com.dan190.tasks.activity.TaskEditActivity}: java.lang.IllegalArgumentException: Target must not be null.
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.IllegalArgumentException: Target must not be null.
at com.squareup.picasso.RequestCreator.into(RequestCreator.java:553)
at com.squareup.picasso.RequestCreator.into(RequestCreator.java:536)
at com.dan190.tasks.fragment.TaskEditFragment.onCreate(TaskEditFragment.java:56)
at android.app.Fragment.performCreate(Fragment.java:2031)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:863)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.app.BackStackRecord.run(BackStackRecord.java:833)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
at android.app.Activity.performStart(Activity.java:5952)
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)
Thanks

Categories

Resources