- Forum posts: 2
Nov 4, 2014, 7:30:16 PM via Website
Nov 4, 2014 7:30:16 PM via Website
Hi Guys,
I was wondering if you could help me out with the below issue basically I have 2 classes which the 2nd one doesn't show the toast captions yet the first one does am I doing something wrong here below is my code. any help would be greatly appreciated
1st class
package freelanceitceltd.ftpwithoutme_beta;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class FTPWELCOME extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
manualentry();
}
private void manualentry() {
//create a reference to the button
Button manualscene = (Button) findViewById(R.id.connectftp);
manualscene = (Button) findViewById(R.id.connectftp);
//set the click listener to run the code.
manualscene.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(
FTPWELCOME.this,
"Please fill out all of the below fields in order to connect or save your server parameters", Toast.LENGTH_LONG)
.show();
//navigates to the next step
setContentView(R.layout.activity_manualconfig);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.ftpwelcome, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
2nd class
package freelanceitceltd.ftpwithoutme_beta;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class manualconfig extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manualconfig);
savesetup();
connect();
}
public void savesetup() {
//create a reference to the button
Button savedata = (Button) findViewById(R.id.saveconfig);
savedata = (Button) findViewById(R.id.saveconfig);
//set the click listener to run the code.
savedata.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(
manualconfig.this,
"Your connection setup details have been saved", Toast.LENGTH_LONG)
.show();
}
});
}
public void connect() {
//create a reference to the button
Button comms = (Button) findViewById(R.id.connectme);
comms = (Button) findViewById(R.id.connectme);
//set the click listener to run the code.
comms.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(
manualconfig.this,
"Your connection details have been saved also", Toast.LENGTH_LONG)
.show();
//navigates to the next step
setContentView(R.layout.activity_manualconfig);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.manualconfig, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.