Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal">
- <Button
- android:id="@+id/hello_worlld"
- android:text="Generate Random IP/Port Now"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"/>
- <TextView
- android:id="@+id/eyy"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:text="127.0.0.1"/>
- </LinearLayout>
- package com.mycompany.WBV2;
- import android.content.Context;
- import android.content.Intent;
- import android.app.Activity;
- import java.util.Random;
- import java.util.*;
- import android.app.*;
- import android.os.*;
- import android.content.*;
- import android.widget.Button;
- import android.net.Uri;
- import android.net.*;
- import java.net.*;
- import android.view.*;
- import android.view.animation.*;
- import java.nio.*;
- import android.widget.*;
- public class MainActivity extends Activity
- {
- final Button b=(Button)findViewById(R.id.hello_worlld);
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- setTitle("Random IP Generator 2.0");
- final Button b1=(Button)findViewById(R.id.hello_worlld);
- final TextView t1=(TextView)findViewById(R.id.eyy);
- b1.setOnClickListener(new View.OnClickListener(){
- public void onClick(View v)
- {
- Random R=new Random();
- int dub=R.nextInt(256);
- int dub1=R.nextInt(256);
- int dub2=R.nextInt(256);
- int dub3=R.nextInt(256);
- int port=R.nextInt(99999);
- t1.setText("\n"+dub+"."+dub1+"."+dub2+"."+dub3+":"+port);
- //Intent I1= new Intent(Intent.ACTION_VIEW,Uri.parse(("http://google.com/search?q="+dub+"."+dub1+"."+dub2+"."+dub3)));
- //startActivity(I1);//https://www.google.com/maps/@34.0625899,-117.5636834,1692m/data=!3m1!1e3
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment