1

Can anyone help me please?

I want my code to work in a way where when I click on a textview in must take me to a new activity.

// 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);
Cherise
  • 29
  • 1
  • 6

1 Answers1

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);
    }
});
Reinherd
  • 5,476
  • 7
  • 51
  • 88