这是我的代码,
// first cube
var geometry = new THREE.BoxGeometry( 100, 100, 100 );
var material = new THREE.MeshLambertMaterial( { color: 0xffffff, morphTargets: true } );
// construct 8 blend shapes
for ( var i = 0; i < geometry.vertices.length; i ++ ) {
var vertices = [];
for ( var v = 0; v < geometry.vertices.length; v ++ ) {
vertices.push( geometry.vertices[ v ].clone() );
if ( v === i ) {
vertices[ vertices.length - 1 ].x *= 2;
vertices[ vertices.length - 1 ].y *= 2;
vertices[ vertices.length - 1 ].z *= 2;
}
}
geometry.morphTargets.push( { name: "target" + i, vertices: vertices } );
}
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
// second cube
var geometry2 = new THREE.BoxGeometry( 100, 100, 100 );
var material2 = new THREE.MeshLambertMaterial( { color: 0x00ffff, morphTargets: true } );
// construct 4 blend shapes
for ( var i = 0; i < geometry2.vertices.length/2; i ++ ) {
var vertices = [];
for ( var v = 0; v < geometry2.vertices.length; v ++ ) {
vertices.push( geometry2.vertices[ v ].clone() );
if ( v === i ) {
vertices[ vertices.length - 1 ].x *= 2;
vertices[ vertices.length - 1 ].y *= 2;
vertices[ vertices.length - 1 ].z *= 2;
}
}
geometry2.morphTargets.push( { name: "target" + i, vertices: vertices } );
}
geometry2.computeMorphNormals();
mesh2 = new THREE.Mesh( geometry2, material2 );
mesh2.position.x = 200;
scene.add( mesh2 );
接收器类代码
public class MainActivity extends Activity
{
public static int c=1;
private PendingIntent pendingIntent;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
notify(7,0,19);
notify(7,0,20);
}
void notify(int date,int hour,int min)
{
int d=date,h=hour,mn=min;
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, d);
calendar.set(Calendar.MONTH, Calendar.SEPTEMBER);
calendar.set(Calendar.YEAR, 2016);
calendar.set(Calendar.HOUR_OF_DAY, h);
calendar.set(Calendar.MINUTE, min);
calendar.set(Calendar.SECOND, 0);
Intent myIntent = new Intent(MainActivity.this, MyReceiver.class);
pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0, myIntent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
}//end onCreate
}
下一个服务类
public class MyReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
Toast.makeText(context, "helloooo", Toast.LENGTH_SHORT).show();
Log.e("ALAARM", "yooooooooooo");
Intent service1 = new Intent(context, NotificationService.class);
context.startService(service1);
}
}
答案 0 :(得分:0)
nm.notify(1, no);
如果您使用相同的ID重新通知,它会更新通知,覆盖旧通知。为每个唯一通知使用不同的ID