Open dudus2000 opened 8 years ago
TextView tv8 = (TextView)FindViewById
如果你是写在fragment中的,那么请用 Textview tv8=(Textview)Inflate.findviewbyId(R.id.text_t1) 另外看不懂你这种怎么写的
At 2016-05-11 15:33:38, "dudus2000" notifications@github.com wrote:
TextView tv8 = (TextView)FindViewById<TextView>(Resource.Id.text_t1);
error "(TextView)FindViewById"
RoletyFragment.cs
using Android.OS; using Android.Views; using Android.Widget; using System; using Fragment = Android.Support.V4.App.Fragment; using Android.Content.Res; using ELibrary; using Android.Graphics;
namespace ResideMenu.Demo { public class RoletyFragment : Fragment { //e start
// Create instance of the ELclass
private ELClass elc = new ELClass(); // Create global instance of ELClass
// This is declaration of timer for the event on timer tick
private System.Timers.Timer tim;
// This is called when the screen rotates. Watch [Activity] section
public override void OnConfigurationChanged(Configuration newConfig)
{
base.OnConfigurationChanged(newConfig);
}
// stop
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle)
{
return inflater.Inflate(Resource.Layout.rolety, container, false);
//e start
// c1
elc.ON_EL_pool_received_C1 += new ELClass.MyEventHandlerC1(EL_rx_event_handler_C1);
elc.EL_init_memory_and_structure_C1(); // Just init several variables and structures for C
// "Password". Use the Salt only if if the password is empty,
elc.EL_process_password("password", "C1");
// ------------------------
// TIMER
// ------------------------
tim = new System.Timers.Timer();
// Trigger event every 1 second (1000ms)
tim.Interval = 1000;
// The event handler of the timer
tim.Elapsed += OnSecondTick;
// Start timer
tim.Enabled = true;
}
// ===============================================================================
// This is Timer Tick event. It sends requests for data.
private void OnSecondTick(object sender, System.Timers.ElapsedEventArgs e)
{
elc.EL_pool_command_c1(
elc.cC1.expanded_key, // AES256 Key after expansion
0x01, // Unique command code for this particuar action
"10.0.5.100", // String IP Address of the relay ex: "10.0.5.100"
27136, // Int UDP port of the relay ex: 27136
1000, // Transmit timeout over the network in miliseconds
1000, // Receive timeout from the network in miliseconds
"Europe/Berlin" // The name of the standard timezone where the relay is located. Zone name is different than in Windows
);
}
// ===============================================================================
public void EL_rx_event_handler_C1(Object sender, EventArgs e)
{
TextView tv8 = (TextView)FindViewById<TextView>(Resource.Id.text_t1);
// You must not write directly to the UI in the event handler !!!!
Action action = delegate {
tv8.Text = elc.STR_C1.DS18TEMP[0].ToString("f1") + " °C";
tv8.SetTextColor(Color.Green);
};
tv8.Post(action);
}
//e stop }
}
LAYOUT rolety.axml
android:text="Wait" android:id="@+id/text_t1" android:textSize="25dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" />
Please help in displaying the layot , text_t1 . Thank You
ps.if you need it spreading Eliblary.dll
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub
RoletyFragment.cs
using Android.OS; using Android.Views; using Android.Widget; using System; using Fragment = Android.Support.V4.App.Fragment; using Android.Content.Res; using ELibrary; using Android.Graphics;
namespace ResideMenu.Demo { public class RoletyFragment : Fragment { //e start
}
LAYOUT rolety.axml <TextView android:text="Wait" android:id="@+id/text_t1" android:textSize="25dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" />
Please help in displaying the layot , text_t1 . Thank You
ps.if you need it spreading ELibrary.dll