I'm a copy and paste coder, this may be really silly...
I have a custom dialog that comes up after my widget is clicked:
public class ClockHandler extends Activity { final Context context = this; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.clockhandler); dialog.setTitle("Available Clocks..."); // set the custom dialog components - text, image and button TextView text = (TextView) dialog.findViewById(R.id.text); text.setText("System Clocks"); text.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast.makeText(getApplicationContext(), "Searching for System Clock...", Toast.LENGTH_SHORT).show(); // Trying to open System Clock // referencing https://stackoverflow.com/a/4281243/805031 } }); TextView text2 = (TextView) dialog.findViewById(R.id.text2); text2.setText("More Clock Widgets!"); text2.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toast.makeText(getApplicationContext(), "Clock Widget Gallery Coming SOON!!!", Toast.LENGTH_LONG).show(); // Open clock widget gallery // eventually } }); dialog.show(); } } I'd like to implement https://stackoverflow.com/a/4281243/805031 solution when TextView text is clicked. I have tried all sorts of arrangements, including:
using https://stackoverflow.com/a/4281243/805031 in a separate file SystemClock.java and then trying to call that from my ClockHandler with things like
final RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.clockhandler); final PendingIntent intent = SystemClock.getClockIntent(context); if (intent != null){ rv.setOnClickPendingIntent(R.id.text, intent); and
Intent intent = new Intent(); PendingIntent.getActivity(context, 0, intent, 0); and also including the https://stackoverflow.com/a/4281243/805031 solution in the ClockHandler file under the public void onClick(View v) {