This this the necessary code:
public class Saves extends Activity {
private Context context;
protected String[][] s;
protected String fileDir;
protected Activity activity;
private static AlertDialog alert_reset;
public void updatelv(Activity activity) {
SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(context);
String fileName = getResources().getString(R.string.fileName);
fileDir = "" + preferences.getString("login", "") + "."+
preferences.getString("marque", "") + ".";
s = myIO.ReadFilePerLine(getApplicationContext(),
fileDir+fileName);
ListView L = (ListView) findViewById(R.id.lv);
L.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item,
s[0]));
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.histo);
context = getApplicationContext();
activity = this;
final SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(context);
String fileName = getResources().getString(R.string.fileName);
fileDir = "" + preferences.getString("login", "") + "."+
preferences.getString("marque", "") + ".";
s = myIO.ReadFilePerLine(getApplicationContext(), fileDir +
fileName);
updatelv(this);
ListView L = (ListView) findViewById(R.id.lv);
L.setTextFilterEnabled(true);
I tried making Log.d("carburant",s[0]), i have an error message: The
method d(String, String) in the type Log is not applicable for the
arguments (String, String[])
So, what do you think about the code? is that correct ?
On 19 mar, 15:10, Kostya Vasilyev <[email protected]> wrote:
> Use the debugger and verify that the values in "s[0]" are what they
> should be. If not, find out why and fix it.
>
> In addition to the above, I think you're setting the adapter twice -
> first directly in onCreate, then from a method called from onCreate.
> This should not be necessary.
>
> -- Kostya
>
> 19.03.2011 16:20, Alaeddine Ghribi пишет:
>
>
>
>
>
>
>
>
>
> > Sorry but how to do it with my instructions ?
> > ListView L = (ListView) findViewById(R.id.lv);
> > L.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item,
> > s[0]));
>
> > log.d(......) ?
> > Thanks.
> > On 19 mar, 13:42, Kostya Vasilyev<[email protected]> wrote:
> >> Ah.
>
> >> No, if you always display the entire data set, then ArrayAdapter should
> >> work fine.
>
> >> Just use the debugger, and check what data you actually pass to the
> >> adapter.
>
> >> -- Kostya
>
> >> 19.03.2011 15:12, Alaeddine Ghribi пишет:
>
> >>> In fact i have 2 edittbox and other one to show the result, then
> >>> storing it. When i access to the "display" activity i have to show all
> >>> the datas that i've been added!
> >>> So, the procedure that you've talked about is it valid in this case ?
> >>> Thanks.
> >> --
> >> Kostya Vasilyev --http://kmansoft.wordpress.com
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en