BrU32

Java Android Random Location Generator/Viewer SRC

Mar 6th, 2017
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. package com.mycompany.WBV2;
  2. import android.content.Context;
  3. import android.content.Intent;
  4. import android.app.Activity;
  5. import java.util.Random;
  6. import java.util.*;
  7. import android.app.*;
  8. import android.os.*;
  9. import android.content.*;
  10. import android.widget.Button;
  11. import android.net.Uri;
  12. import android.net.*;
  13. import java.net.*;
  14. import android.view.*;
  15. import android.view.animation.*;
  16. import java.nio.*;
  17.  
  18. public class MainActivity extends Activity
  19. {
  20. final Button b=(Button)findViewById(R.id.hello_worlld);
  21. @Override
  22. protected void onCreate(Bundle savedInstanceState)
  23. {
  24. super.onCreate(savedInstanceState);
  25. setContentView(R.layout.main);
  26. setTitle("Location Generator/Viewer 2.0");
  27. final Button b1=(Button)findViewById(R.id.hello_worlld);
  28. b1.setOnClickListener(new View.OnClickListener(){
  29. public void onClick(View v)
  30. {
  31. Random R=new Random();
  32. int dub=R.nextInt(999);
  33. int dub1=R.nextInt(999);
  34. int dub2=R.nextInt(999);
  35. int dub3=R.nextInt(999);
  36. Intent I1= new Intent(Intent.ACTION_VIEW,Uri.parse(("geo:"+dub+"."+dub1+","+dub2+"."+dub3)));
  37. startActivity(I1);//https://www.google.com/maps/@34.0625899,-117.5636834,1692m/data=!3m1!1e3
  38. }
  39.  
  40. });
  41.  
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment