I am working on an app where there are two buttons "Cameara" and "Upload".By default I disable a Upload button and when I take the photo using the camera intent I then display the Upload button using View.VISIBLE.But on samsung Galaxy Tab the upload button is not getting displayed in the portrait mode but works in the landscape mode
The code is as under:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
android.app.ActionBar ab = getActionBar();
progress = new ProgressDialog(this);
progress.setMessage("Connecting to the server");
ColorDrawable colorDrawable = new ColorDrawable(Color.parseColor("#FF3366"));
ab.setBackgroundDrawable(colorDrawable);
//imgFavorite = (ImageView)findViewById(R.id.imageView1);
Camera = (Button)findViewById(R.id.btncamera);
Upload = (Button)findViewById(R.id.btnupload);
Upload.setVisibility(View.INVISIBLE);
Upload.setOnClickListener(this);
//TextView text =(TextView)findViewById(R.id.textView1);
Camera.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
open();
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode == RESULT_OK){
// clicked.equals(true);
super.onActivityResult(requestCode, resultCode, data);
gps = new GPSTracker(MainActivity.this);
// check if GPS enabled
if(gps.canGetLocation())
{
// here I enable the upload button
Upload.setVisibility(View.VISIBLE);
latitude = gps.getLatitude();
longitude = gps.getLongitude();
Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " +
latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
}
else
{
gps.showSettingsAlert();
}
}
}
0 comments:
Post a Comment