我收到错误
无效的方法声明,需要返回类型 缺少方法主体
private void AutomaticServerConnect()
{
new Thread(new Runnable() {
public void run() {
response = Get(HttpCommandToSend(iptouse, 8098, "nothing"));
text = (TextView) findViewById(R.id.textView2);
if (response != null)
{
try
{
final String a = new String(response, "UTF-8");
text.post(new Runnable()
{
@Override
public void run()
{
text.setText(a + " On \n" + ipaddresses[counter]);
status1.setText("Connected");
String successconnected = null;
successconnected = "Successfully connected";
textforthespeacch = successconnected;
MainActivity.this.initTTS();
}
});
iptouse = ipaddresses[i].substring(0, ipaddresses[i].lastIndexOf("=") + 1);
connectedtoipsuccess = true;
connectedSuccess = true;
Logger.getLogger("MainActivity(inside thread)").info(a);
if (!iptouse.isEmpty())
{
}
} catch (UnsupportedEncodingException e)
{
e.printStackTrace();
Logger.getLogger("MainActivity(inside thread)").info("encoding exception");
}
Logger.getLogger("MainActivity(inside thread)").info("test1");
}
else
{
text.post(new Runnable()
{
@Override
public void run()
{
text.setText("Connection Failed");
status1.setText("Connection Failed");
String successconnected = null;
successconnected = "connection failed";
textforthespeacch = successconnected;
MainActivity.this.initTTS();
}
});
}
}).start();
});
我收到了错误:
}).start();
无效的方法声明,需要返回类型
缺少方法主体
还有一行错误
});
}预期
答案 0 :(得分:1)
正确的缩进将帮助您找到无效的大括号:
run
您已关闭Runnable
方法,但未关闭匿名private void AutomaticServerConnect()
{
new Thread(new Runnable() {
public void run() {
...
} // added }
}).start();
} // removed );
实例。
应该是:
psql (9.4.5)
forex=# \d pair_data;
Table "public.pair_data"
Column | Type | Modifiers
------------+-----------------------------+--------------------------------------------------------
id | integer | not null default nextval('pair_data_id_seq'::regclass)
pair_name | character varying(6) |
pair_price | numeric(9,6) |
ts | timestamp without time zone |
Indexes:
"pair_data_pkey" PRIMARY KEY, btree (id)
"date_idx" gin (ts)
"pair_data_gin_idx1" gin (pair_name)
"pair_data_gin_idx2" gin (ts)
答案 1 :(得分:-1)
计算你的花括号。你错过了某个地方的近距离支撑。