Re: [mono-android] How to use Orientation OnConfiguration method in monoandroid

2013-03-01 Thread pushtest82
How to use Orientation in mono for android?

Here I post my code ,

[Activity (Label = "Setting",Theme =
"@android:style/Theme.Black.NoTitleBar.Fullscreen",ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation|Android.Content.PM.ConfigChanges.KeyboardHidden)]
//,ScreenOrientation = ScreenOrientation.Sensor 
public class Setting : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

//SetContentView(Resource.Layout.settingscreen);
   
onConfigurationChanged(getResources().getConfiguration());

}

public override void OnConfigurationChanged
(Android.Content.Res.Configuration newConfig)
{
base.OnConfigurationChanged (newConfig);



if(newConfig.Orientation==Android.Content.Res.Orientation.Landscape)
{

SetContentView(Resource.Layout.settingscreen_ls);

Button 
logout_btn=FindViewById(Resource.Id.logout_btn);
logout_btn.Click+= delegate {
StartActivity(typeof(LoginScreen));
};

}
else 
if(newConfig.Orientation==Android.Content.Res.Orientation.Portrait){
SetContentView(Resource.Layout.settingscreen);

Button 
logout_btn=FindViewById(Resource.Id.logout_btn);
logout_btn.Click+= delegate {
StartActivity(typeof(LoginScreen));
};
}

}

}
}


onConfigurationChanged(getResources().getConfiguration()); calling this
method in onCreate ,its showing error.what method we have to call it?
Bcoz I am new to monoandroid,Comparing to Android(native) is easy to use
orientation...Y?,its not easy way to use orientation in monoandroid?CAN
ANYONE HELP ME!!!.



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/OnConfiguration-is-not-being-called-tp5566767p5712943.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] How to use Orientation onConfigurationChanged method in monoandroid?

2013-03-01 Thread pushtest82
Hi All,

Anyone one can help me...I don't know how to use both landscape and portrait
mode ...When I design and modify the landscape and portrait means ,its
automatically  design was also changed in other mode ..So I plan to use two
different screens name and call it in onConfigurationChanged method.But I
don't know how to call it in oncreate method.if I call  means its showing
some error..
Anyone can say whether  ,a proper way of using orientation in mono for
android..Here I post my code also.

[Activity (Label = "Setting",Theme =
"@android:style/Theme.Black.NoTitleBar.Fullscreen",ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation|Android.Content.PM.ConfigChanges.KeyboardHidden)]
//,ScreenOrientation = ScreenOrientation.Sensor 
public class Setting : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

//SetContentView(Resource.Layout.settingscreen);
//OnConfigurationChanged();
//SetContentView(OnConfigurationChanged);

//OnConfigurationChanged();

 
onConfigurationChanged(getResources().getConfiguration());
}

public override void OnConfigurationChanged
(Android.Content.Res.Configuration newConfig)
{
base.OnConfigurationChanged (newConfig);



if(newConfig.Orientation==Android.Content.Res.Orientation.Landscape)
{

SetContentView(Resource.Layout.settingscreen_ls);

Button 
logout_btn=FindViewById(Resource.Id.logout_btn);
logout_btn.Click+= delegate {
StartActivity(typeof(LoginScreen));
};

}
else 
if(newConfig.Orientation==Android.Content.Res.Orientation.Portrait){
SetContentView(Resource.Layout.settingscreen);

Button 
logout_btn=FindViewById(Resource.Id.logout_btn);
logout_btn.Click+= delegate {
StartActivity(typeof(LoginScreen));
};
}

}

}
}


Give me a exact solution for using  orientation in monoandroid!

Thanks & Regards

Pushtest82



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/How-to-use-Orientation-onConfigurationChanged-method-in-monoandroid-tp5712944.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid