Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try the below code:</p> <pre><code>public class MainActivity extends Activity { Button btn; TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.textView1); btn = (Button) findViewById(R.id.button1); } public void getThis(View v) { String str = "35" + Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; tv.setText(str); UploadUniqueID uni = new UploadUniqueID(this, str); uni.execute(str); } class UploadUniqueID extends AsyncTask&lt;String, Integer, String&gt; { Context context; MainActivity ma; ProgressDialog dialog; String id; public UploadUniqueID(MainActivity activity, String str) { ma = activity; context = activity; dialog = new ProgressDialog(activity); id = str; } protected void onPreExecute() { dialog.setMessage("Progress start"); dialog.setCancelable(true); dialog.show(); } @Override protected String doInBackground(String... params) { // perform long running operation operation String id = params[0]; HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://10.0.2.2/UniqueIdApp/myPHP.php"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;( 1); nameValuePairs.add(new BasicNameValuePair("android", id)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); httpclient.execute(httppost); } catch (Exception e) { Log.i("HTTP Failed", e.toString()); } return null; } protected void onProgressUpdate(Integer... integers) { } protected void onPostExecute(String p_result) { super.onPostExecute(p_result); tv.setText("Sent"); if (dialog.isShowing()) { dialog.dismiss(); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload