BrU32

Android Java Random IP Generator Demo SRC V1!!!!!

Mar 6th, 2017
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:layout_width="wrap_content"
  3. android:layout_height="wrap_content"
  4. android:gravity="center_horizontal">
  5. <Button
  6. android:id="@+id/hello_worlld"
  7. android:text="Generate Random IP/Port Now"
  8. android:layout_height="wrap_content"
  9. android:layout_width="wrap_content"/>
  10. <TextView
  11. android:id="@+id/eyy"
  12. android:layout_height="wrap_content"
  13. android:layout_width="wrap_content"
  14. android:text="127.0.0.1"/>
  15. </LinearLayout>
  16.  
  17. package com.mycompany.WBV2;
  18. import android.content.Context;
  19. import android.content.Intent;
  20. import android.app.Activity;
  21. import java.util.Random;
  22. import java.util.*;
  23. import android.app.*;
  24. import android.os.*;
  25. import android.content.*;
  26. import android.widget.Button;
  27. import android.net.Uri;
  28. import android.net.*;
  29. import java.net.*;
  30. import android.view.*;
  31. import android.view.animation.*;
  32. import java.nio.*;
  33. import android.widget.*;
  34.  
  35. public class MainActivity extends Activity
  36. {
  37. final Button b=(Button)findViewById(R.id.hello_worlld);
  38. @Override
  39. protected void onCreate(Bundle savedInstanceState)
  40. {
  41. super.onCreate(savedInstanceState);
  42. setContentView(R.layout.main);
  43. setTitle("Random IP Generator 2.0");
  44. final Button b1=(Button)findViewById(R.id.hello_worlld);
  45. final TextView t1=(TextView)findViewById(R.id.eyy);
  46. b1.setOnClickListener(new View.OnClickListener(){
  47. public void onClick(View v)
  48. {
  49. Random R=new Random();
  50. int dub=R.nextInt(256);
  51. int dub1=R.nextInt(256);
  52. int dub2=R.nextInt(256);
  53. int dub3=R.nextInt(256);
  54. int port=R.nextInt(99999);
  55. t1.setText("\n"+dub+"."+dub1+"."+dub2+"."+dub3+":"+port);
  56. //Intent I1= new Intent(Intent.ACTION_VIEW,Uri.parse(("http://google.com/search?q="+dub+"."+dub1+"."+dub2+"."+dub3)));
  57. //startActivity(I1);//https://www.google.com/maps/@34.0625899,-117.5636834,1692m/data=!3m1!1e3
  58. }
  59.  
  60. });
  61.  
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment