2
Good afternoon,
I’m having trouble with setContent it reports the following error: Cannot solves Symbol 'Main'
This is happening in the ->
protected void onCreate(Bundle savedInstanceState) {
This 'Main' file is in: app -> res -> layout -> Main.xml
Java tools.
package view;
public class Tools extends Activity {
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
@Override
public void onStart() {
super.onStart();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.connect();
AppIndex.AppIndexApi.start(client, getIndexApiAction());
}
@Override
public void onStop() {
super.onStop();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
AppIndex.AppIndexApi.end(client, getIndexApiAction());
client.disconnect();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.Principal);
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
public Action getIndexApiAction() {
Thing object = new Thing.Builder()
.setName("Main Page") // TODO: Define a title for the content shown.
// TODO: Make sure this auto-generated URL is correct.
.setUrl(Uri.parse("http://[ENTER-YOUR-URL-HERE]"))
.build();
return new Action.Builder(Action.TYPE_VIEW)
.setObject(object)
.setActionStatus(Action.STATUS_TYPE_COMPLETED)
.build();
}
public void call_Desligar(View tools) {
try {
Process proc = Runtime.getRuntime().exec(new String[]{"su", "-c", "reboot -p"});
proc.waitFor();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void call_Reiniciar(View tools) {
try {
Process proc = Runtime.getRuntime().exec(new String[]{"su", "-c", "reboot"});
proc.waitFor();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void call_Sair(View tools) {
System.exit(0);
}
}
I believe that the name of your layout can not be Main with more letters, try to refactor it to layout_principal
– Leonardo Dias
All right, I’ll be right back.
– Júnior
Unfortunately not solved. Thank you
– Júnior