Android Open Source - NotificationStopwatch Create Shortcut Activity






From Project

Back to project page NotificationStopwatch.

License

The source code is released under:

Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble Thi...

If you think the Android project NotificationStopwatch listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.kodarkooperativet.notificationstopwatch;
/* w  ww. j a  v  a2  s.c o  m*/
import android.app.Activity;
import android.content.Intent;
import android.content.Intent.ShortcutIconResource;
import android.os.Bundle;

/**
 * 
 * Copyright 2013 KodarKooperativet
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 * 
 * Used for Creating the simple remote start shortcut.
 * 
 * @author KodarKooperativet
 * 
 */
public class CreateShortcutActivity extends Activity {

  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher);

    Intent intent = new Intent();

    Intent launchIntent = new Intent(this, ServiceStartActivity.class);
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_label));
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
    setResult(RESULT_OK, intent);
    finish();
  }
}




Java Source Code List

com.kodarkooperativet.notificationstopwatch.CreateShortcutActivity.java
com.kodarkooperativet.notificationstopwatch.ServiceStartActivity.java
com.kodarkooperativet.notificationstopwatch.StopwatchActivity.java
com.kodarkooperativet.notificationstopwatch.TimeService.java