Back to project page android-blog-reader.
The source code is released under:
MIT License
If you think the Android project android-blog-reader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.teamtreehouse.blogreader; //from w ww. j a v a2 s. com import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.webkit.WebView; public class BlogWebViewActivity extends Activity { protected String mUrl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_blog_web_view); Intent intent = getIntent(); Uri blogUri = intent.getData(); mUrl = blogUri.toString(); WebView webView = (WebView) findViewById(R.id.webView1); webView.loadUrl(mUrl); } @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_blog_web_view, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int itemId = item.getItemId(); if (itemId == R.id.action_share) { sharePost(); } return super.onOptionsItemSelected(item); } private void sharePost() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, mUrl); startActivity(Intent.createChooser(shareIntent, getString(R.string.share_chooser_title))); } }