androstep6
To call them, now, just do:

 

strToSent = textToSend.getText().toString();
strPort = Integer.toString(port);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1)
    new sendOnNetwork().execute(ip, strPort, strToSent);
else
    new sendOnNetwork().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ip, strPort, strToSent);


Note: for now, strPort and ip are hardcoded and strToSend comes from the GUI.

And

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1)
    new listenNetwork().execute();
else
    new listenNetwork().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

Note:

Will run as long as the app run. Due to the way it’s coded, it is possible that if you send to the phone a high amount of data, it will miss a few during the transition from socket.receive(datagramPacket); to new listenNetwork().execute(); in onPostExecute. This hasn’t been tested yet.

Finally, I should warn you that this app doesn’t have any space in the internal memory. You could include a SQL data base to fix that. If you want to do this, I refer you always to the same playlist, more specifically, form this point. This part either require a knowledge of SQL or a good understanding of Android, I advise you to tackle it only if you are in advance on your project.

Back

Android Item List – Step 6
Tagged on:         

One thought on “Android Item List – Step 6

Leave a Reply