Continuation of the last question.

There are 2 classes. It is necessary in class 2, to perform the method of 1. The method itself:

public void FLYNOTE_refresh(){ SharedPreferences Pref = getSharedPreferences("nnote", MODE_WORLD_READABLE); key = Pref.getInt("number", 0); String lv_arr[] = new String[key]; for (int i = 0; i < key; i++){ lv_arr[i] = Pref.getString("n" + i, "none"); noten = i; } textView1.setText(String.valueOf(key)); listView1.setAdapter( new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr)); listView1.setTextFilterEnabled(true); } listView1.setTextFilterEnabled(true); } 

How I call it:

 Client client = new Client(); client.FLYNOTE_refresh(); 

The application throws an error.

Classes look like this (I will not throw all the class code, too much of it):

 public class Newnote extends Activity implements OnClickListener { 


 public class Client extends Activity implements OnClickListener { 
  • And the old question was not destiny to edit? This is the first. Secondly, for the first time I see an instance of the activation of TAK created. Thirdly, I understand FLYNOTE_refresh belongs to the class Newnote? In that case, based on what you are trying to do, I feel sorry for you. Do not touch while android and Java, read about C or Pascal - LackOfKnowledge
  • But what about C and Pascal, then read? How does this help? Then it's better in Java and to read the same Horstmann and Cornell - rasmisha
  • The question is - why are you doing this? - Gorets
  • @Gorets most likely some kind of bike, like startActivityForResult Although why the instance Client is not clear at all, is it really data transfer between activations? O_O - rasmisha
  • Vryatli, the codes show that he is trying to update the data and a friend from one activation, and the invisible one - Gorets

1 answer 1

I do not pretend to be correct, but I will try to state my thoughts

Most likely, nothing is initialized in the Client class (the constructor is empty, isn't it?)

I suspect the entire initialization logic is in OnCreate () and all the controls you have are null

In general, I think some kind of strange architectural approach

PS Most likely the Activity should be contextual.