저는 시계 모드에서 작동 중이지만 작동 중입니다. 360에 장착하면 상호 작용에 느리게 반응합니다.Android Wear가 화면을 깨우지 못합니다.
알림을받을 때 화면이 깨어나지만 손목을 돌려 시각을 볼 때가 아님을주의해야합니다.
내가 한 마지막 일은 doWork에서 코드를 CountDownRunner로 옮기는 것이 었습니다.
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.text.format.Time;
import android.support.wearable.view.WatchViewStub;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.Date;
public class ClockActivity extends Activity {
private TextView mTextView;
private Handler mHandler = new Handler();
private ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_clock);
Runnable runnable = new CountDownRunner();
Thread myThread = new Thread(runnable);
myThread.start();
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
mTextView = (TextView) stub.findViewById(R.id.text);
}
});
}
class CountDownRunner implements Runnable{
public void run() {
while(!Thread.currentThread().isInterrupted()){
try {
Date dt = new Date();
int hours = dt.getHours();
int minutes = dt.getMinutes();
int seconds = dt.getSeconds();
String curTime = hours + ":" + minutes + ":" + seconds;
img=(ImageView)findViewById(R.id.hand_second);
RotateAnimation rotateAnimation = new RotateAnimation((seconds-1)*6, seconds*6,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setDuration(1000);
rotateAnimation.setFillAfter(true);
img.startAnimation(rotateAnimation);
runOnUiThread(new Runnable() {
public void run() {
try{
}catch (Exception e) {
}
}
});
Thread.sleep(1000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}catch(Exception e){
}
}
}
}
}
그래서 나는 그것을 모두 업데이트했지만 이제는 초침을 다시 작동시키는 것 같습니다. 모든 것을 준비하고 실행할 때까지 나는 에뮤 테스트를 마쳤습니다. 코드를 확인 하시겠습니까? http://pastebin.com/RzmJ5vCW – JMP
BroadcastReceiver 메서드를 사용하면 분만 변경 될 때만 updateUI() 메서드가 호출됩니다. 웨어러블 장치가 깨어 있지 않을 때 메모리 누수를 방지합니다. 웨어러블 스크린이 깨어날 때 실행 가능한 스크립트를 추가하여 초 애니메이션을 업데이트하고 웨어러블 스크린이 떨어지면이 실행 파일을 제거 할 수 있습니다. 화면이 꺼져있는 동안 초를 업데이트하면 많은 CPU를 사용하여 배터리를 많이 사용합니다.) – Nasc