I've successfully passed a value from a static class to a non-static one, but I got an error, null value, when I put that value to an EditText.
public class HelloBubblesActivity extends SherlockFragmentActivity { public EditText editText1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_discuss); editText1 = (EditText) findViewById(R.id.editText1); } public static class MyDialogFragment extends SherlockDialogFragment { //i fill variable emotx is "test string" public void emot(String emotx){ HelloBubblesActivity hb=new HelloBubblesActivity(); hb.smiley(emotx); //send value to smiley method.. } } public void smiley(String name){ Log.d("test", name); //result value is "test string" (success) editText1.setText(name); //here is error } } I'm not sure why I'm getting this issue. Can anyone see why this is not doing what is expected?
if(editText1 == null) Log.d("editText1", "null");right before the editText1.setText line and post the logcat including that log if it shows up.