@PathVariable - must be placed in the endpoint uri and access the query parameter value from the request
@RequestParam - must be passed as method parameter (optional based on the required property)
http://localhost:8080/employee/call/7865467
@RequestMapping(value=“/call/{callId}", method = RequestMethod.GET)
public List<Calls> getAgentCallById(
@PathVariable(“callId") int callId,
@RequestParam(value = “status", required = false) String callStatus) {
}
http://localhost:8080/app/call/7865467?status=Cancelled
@RequestMapping(value=“/call/{callId}", method = RequestMethod.GET)
public List<Calls> getAgentCallById(
@PathVariable(“callId") int callId,
@RequestParam(value = “status", required = true) String callStatus) {
}
Activity
не полностью инициализирован и готов к просмотру представлений до тех пор, пока onCreate()
не будет вызван в onCreate()
.
Объявляйте только следующие поля:
private EditText usernameField, passwordField;
private TextView error;
private ProgressBar progress;
] , а затем назначьте значения в onCreate
:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
usernameField = (EditText)findViewById(R.id.username);
passwordField = (EditText)findViewById(R.id.password);
error = (TextView)findViewById(R.id.error);
progress = (ProgressBar)findViewById(R.id.progress);
}
Не может быть частью проблемы, но в качестве дополнительной рекомендации, Timer
запускает TimerTask
на фоне нить, и этого следует избегать в этом случае. Вместо этого замените Timer
на Handler
, чтобы запустить его в потоке пользовательского интерфейса.
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
}, 1500);
Handler
, хотя :) – user 16 April 2016 в 15:50