Java – syntax error: Insert ‘}’ to complete the block
•
Java
My code keeps going wrong I'm making an application to generate quotes Who can help me with this? Whatever I try, I get "syntax error: insert"} "to complete the block When I insert "}", it gives an error saying that my code is "inaccessible". When I add a bracket to make it accessible, it will bring me back to the first error and it is just a loop It drives me crazy! Can I help you? thank you! This is my code:
{
vbjokes = (Button) findViewById(R.id.bjokes);
vbabout = (Button) findViewById(R.id.babout);
vtvdisplay = (TextView) findViewById(R.id.tvdisplay);
vbjokes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
});
vbabout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
vtvdisplay.setText(" Thank you for downloading Punny Jokes!
vtvdisplay.setTextColor(Color.BLACK);
vtvdisplay.setTextSize((float) 20d);
vtvdisplay.setBackgroundColor(Color.GRAY);
}
});
final View controlsView = findViewById(R.id.fullscreen_content_controls);
final View contentView = findViewById(R.id.tvdisplay);
msystemUIHider = systemUIHider.getInstance(this,contentView,HIDER_FLAGS);
msystemUIHider.setup();
msystemUIHider
.setOnVisibilitychangelistener(new systemUIHider.OnVisibilitychangelistener() {
int mControlsHeight;
int mShortAnimTime;
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public void onVisibilityChange(boolean visible) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
if (mControlsHeight == 0) {
mControlsHeight = controlsView.getHeight();
}
if (mShortAnimTime == 0) {
mShortAnimTime = getResources().getInteger(
android.R.integer.config_shortAnimTime);
}
controlsView
.animate()
.translationY(visible ? 0 : mControlsHeight)
.setDuration(mShortAnimTime);
} else {
controlsView.setVisibility(visible ? View.VISIBLE
: View.GONE);
}
if (visible && AUTO_HIDE) {
delayedHide(AUTO_HIDE_DELAY_MILLIS);
}
}
});
contentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (TOGGLE_ON_CLICK) {
msystemUIHider.toggle();
} else {
msystemUIHider.show();
}
}
});
findViewById(R.id.babout).setOnTouchListener(
mDelayHideTouchListener);
}
Solution
Sorry, I will add comments, but my reputation is too low
vtvdisplay. Settext ("thank you for downloading Penny jokes!
It looks like you missed a "); in the end, you copied and pasted it wrong
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
