1

任何人都可以帮助我吗?

我希望我的代码以这样一种方式工作,当我点击一个文本视图时,我必须将我带到一个新的活动中。

// Create an Intent to launch ExampleActivity
        Intent intent = new Intent(context, BrowserActivity.class);
        intent.setData(Uri.parse(ListNewsActivity.news.get(0).getLink()));
        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
                intent, 0);

        // Get the layout for the App Widget and attach an on-click listener
        // to the button
        RemoteViews views = new RemoteViews(context.getPackageName(),
                R.layout.widget1);
        views.setOnClickPendingIntent(R.id.button, pendingIntent);
4

1 回答 1

4
TextView textView = (TextView) this.findViewById(R.id.textView1);
textView.setOnClickListener(new OnClickListener() {
    @Override           
    public void onClick(View v) {
        Intent int = new Intent(this, NewActivity.class);
        startActivity(int);
    }
});
于 2013-09-18T10:10:32.923 回答