我试图从对话框listActivity更改片段
的选择这个项目我listActivity.cs下课后改变目前的片段:这里
[Activity( Theme = "@android:style/Theme.Dialog" , Label ="Number list") ]
class NumberListActivity : ListActivity
{
string[] data;
ArrayAdapter adapter;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
this.data = Intent.GetStringArrayExtra("list_numbers");
adapter = new ArrayAdapter(this, Resource.Layout.specific_contact_number_list_layout, data);
ListAdapter = adapter;
}
protected override void OnListItemClick(ListView l, View v, int position, long id)
{
base.OnListItemClick(l, v, position, id);
//Intent callFragment = new Intent(this, typeof(barMenu));
//callFragment.PutExtra("callNumber", data[position]);
//StartActivity(callFragment);
ISharedPreferences preferences = GetSharedPreferences(SignInActivity.userSessionPref, FileCreationMode.Private);
String UserNamevalueSession = preferences.GetString("UserNamevalue", "");
String UserphonevalueSession = preferences.GetString("Userphonevalue", "");
CallService.phone.Connect(data[position], UserphonevalueSession);
DateTime now = DateTime.Now;
SqliteDB db = new SqliteDB();
db.Insert(data[position], now.ToString());
var frag = new MainActivity();
FragmentManager.BeginTransaction().Replace(Resource.Id.conent_fragment, frag).Commit();
Finish();
}
}
一切正常,非常以及我只需要更改片段后,单击项目
我试过
var frag = new MainActivity();
FragmentManager.BeginTransaction().Replace(Resource.Id.conent_fragment, frag).Commit();
但它给我
12月9日至27日:57:00.247 E/AndroidRuntime(11446): java.lang.IllegalArgumentException异常:未找到ID视图0x7f080079 (TurkeyanaCall.TurkeyanaCall:ID/conent_fragment),用于片段 MainActivity {4b067018#0的id = 0x7f080079}
我specific_contact_number_list_layout.xmal代码
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/number_list"
android:textColor="#37c837"
android:textSize="20dip"
android:textStyle="italic"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft ="20dp"
android:padding ="10dp"
/>
这是包含我想改变其命名为bar_menu.xmal
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/maintActivity_drawerlayout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/linearView">
<fragment
class="TwilioClientTest.Android.MainMenuFragment"
android:id="@+id/conent_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/maintActivity_navigationView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@drawable/shadow"
app:menu="@menu/left_menus"
app:theme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.v4.widget.DrawerLayout>
能否请您发布'NumberListActivity'和XAML代码的详细代码?所以我们可以知道你想改变哪个片段? –
我添加了我的xaml页面布局代码 –
即时通讯从android.support.v4.widget.DrawerLayout更改片段其作品,但我有电话簿在我的应用程序,我想要点击联系人名称时,我希望它拨打联系人并移动到调用片段,我可以打电话,因为它的调用使用服务,但我希望在调用期间改变片段 –