public static void main(String[] args) throws InterruptedException {
PrintServerV1 server = new PrintServerV1();
new Thread(server).start();
server.printRequest("homework7.txt"); // these throw an exception
server.printRequest("assignment4.txt"); // That is "InterruptedException"
server.printRequest("speech.pdf"); // It must be caught, or declared thrown!
// Version 1 declares it thrown (above in method declaration)
}
public static void main(String[] args) {
PrintServerV1 server = new PrintServerV1();
try {
new Thread(server).start();
server.printRequest("homework7.txt");
server.printRequest("assignment4.txt");
server.printRequest("speech.pdf");
catch (InterruptedException e) { e.printStackTrace(); } // Version 2 catches it
}
我正试图通过检查我的片段
中的文档来运行个性洞察力FATAL EXCEPTION: main
Process: com.example.dell.ora, PID: 24491
android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147)
at java.net.InetAddress.lookupHostByName(InetAddress.java:418)
at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
at java.net.InetAddress.getAllByName(InetAddress.java:215)
at com.squareup.okhttp.Dns$1.lookup(Dns.java:39)
at com.squareup.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:175)
at com.squareup.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:141)
at com.squareup.okhttp.internal.http.RouteSelector.next(RouteSelector.java:83)
at com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174)
at com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
at com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
at com.squareup.okhttp.Call.getResponse(Call.java:286)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
at com.squareup.okhttp.Call.execute(Call.java:80)
at com.ibm.watson.developer_cloud.service.WatsonService.execute(WatsonService.java:122)
at com.ibm.watson.developer_cloud.service.WatsonService.executeRequest(WatsonService.java:183)
at com.ibm.watson.developer_cloud.personality_insights.v2.PersonalityInsights.getProfile(PersonalityInsights.java:119)
at com.example.dell.ora.AnalyzerFragment.onCreateView(AnalyzerFragment.java:39)
要做到这一点,我插入了我的gradle文件
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View x = inflater.inflate(R.layout.fragment_analyzer, container, false);
PersonalityInsights service = new PersonalityInsights();
service.setUsernameAndPassword("", "");
service.setEndPoint("https://gateway.watsonplatform.net/personality-insights/api");
EditText content= x.findViewById(R.id.content);
TextView output= x.findViewById(R.id.output);
// String text = content.getText().toString();
String text =getResources().getString(R.string.demo);
Profile profile = service.getProfile(text);
System.out.println(profile);
return x;
}
有没有人遇到过这个错误?可以说明我做错了什么吗?提前谢谢你!
答案 0 :(得分:1)
char *, char *, int
或使用异步任务。您只能在 from sklearn.metrics import confusion_matrix
conf = confusion_matrix(pred["y"], pred["PredictedLabel"])
print(conf)
中初始化布局和视图。所有其他对象初始化必须在new Thread(new Runnable(){Profile profile = service.getProfile(text);
}).start();
onCreateView