Jump to content
Nytro

Andoird App wiht buttons that link to sites

Recommended Posts

Posted

Andoird App wiht buttons that link to sites



package com.example.packagename;


import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.View;

public class MainActivity extends Activity {
public static final String TAG = "app name here";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

public void processClick(View display) {
int id = display.getId();
switch (id) {
case (R.id.displayWebsite):
Log.i(TAG, "Loading ");
Intent website = new Intent(Intent.ACTION_VIEW, Uri.parse("(insert link here)"));
startActivity(website);
break;
case (R.id.communityDisplay):
Log.i(TAG, "Loading ");
Intent community = new Intent(Intent.ACTION_VIEW, Uri.parse("(insert link here)");
startActivity(community);
break;
case (R.id.youtube):
Log.i(TAG, "Loading ");
Intent channel = new Intent(Intent.ACTION_VIEW, Uri.parse("(insert link here)"));
startActivity(channel);
break;
default:
break;

}
}

}

Sursa: r00tsecurity -> Source Code Center :: Andoird App wiht buttons that link to sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...