如何通过传递intent在New Activity的Webview中打开URL

时间:2018-01-15 17:05:53

标签: android json webview

这里我打开浏览器中从JSON Feed获取的URL。我需要在另一个新活动的webview中打开URL。我创建了新的活动,我也保留了webview。但是Intent没有传递String

以下是在浏览器中打开URL的当前代码

@Override
public void onBindViewHolder(CourseViewHolder holder, int position) {

    final Course course = courseList.get(position);
    holder.textViewCoursename.setText(course.getCoursename());
    holder.textViewcoursedescshort.setText(course.getCoursedescshort());
    holder.textViewcourserating.setText(course.getCourserating());

    Glide.with(context).load(course.getCourseimg()).into(holder.imageView);    

    holder.itemView.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(course.getCourseurl()));
            context.startActivity(i);
        }
    });
}

1 个答案:

答案 0 :(得分:0)

您需要使用bpftool prog show代替import sys import os if os.uname()[1] == 'iMac': sys.path.append("/Users/mgreene3/Library/Python/2.7/lib/python/site-packages") else: sys.path.append("/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python") import numpy as np import math import random import textwrap from docx import Document from docx.shared import Pt, Inches from docx.enum.style import WD_STYLE_TYPE from docx.text.tabstops import TabStop as ts from docx.text.parfmt import ParagraphFormat assignment = Document() ordered = "a" style = assignment.styles["Normal"] font = style.font font.name = "Calibri" font.size = Pt(12) style.paragraph_format.space_after = Pt(0) LetteredList = style.paragraph_format._NumberingStyle(ordered) sub_style = assignment.styles["ListBullet"] sub_font = sub_style.font sub_font.name = "Calibri" ###sub_style.paragraph_format.style("List") sub_font.size = Pt(12) sub_style.paragraph_format.left_indent = Inches(1) sub_style.paragraph_format.space_before = Pt(0) sub_style.paragraph_format.space_after = Pt(40) doc_heading = assignment.add_paragraph("Name:_______________________") doc_heading.add_run("\t" * 4) doc_heading.add_run(" " * 12) doc_heading.add_run("BIOL444: Biochemistry\t\t\t\t\t\t ") doc_heading.add_run("\n") doc_heading.add_run("Take Home 1, v.") doc_heading.add_run((str(1).zfill(2))) doc_heading.add_run("\n" * 2) doc_heading.add_run("Instructions: Complete test (") show_work = doc_heading.add_run("show work") show_work.bold = True show_work.underline = True show_work doc_heading.add_run("), submit ") hard_copy = doc_heading.add_run("hard copy") hard_copy.bold = True hard_copy.underline = True hard_copy doc_heading.add_run(" by ") doc_heading.add_run("11:59 pm, Friday, February 10").bold =True doc_heading.add_run(". Late submissions will ") doc_heading.add_run("NOT").bold=True doc_heading.add_run(" be accepted.") question1 = assignment.add_paragraph("Using the data for K", style = "List Number") question1.add_run("a").font.subscript = True question1.add_run(" and pK") question1.add_run("a").font.subscript = True question1.add_run(" of the following compounds, calculate the concentrations (M) of all ionic species as well as the pH of the following aqueous solutions: ") question1.add_run("\n") question1a = assignment.add_paragraph("100 mM Acetic acid", style = sub_style) question1b = assignment.add_paragraph("250 mM NaOH", style = sub_style) assignment.save("TestDocx.docx") 。您将需要一个该值的密钥。

你将通过新活动中的密钥获得它:

i.putExtra(KEY, yourURL)