- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有我的自定义 SimpleCursorAdapter
MySqlCursorAdapter。我想在我的类 PageFragment
中使用 MySqlCursorAdapter
但是,我有一个错误。
寻呼机 Activity
public class Pager extends FragmentActivity {
SQLiteDatabase db;
Cursor c;
ContentValues cv;
static final String Tag = "States";
static final int PAGE_COUNT = 4;
ViewPager pager;
PagerAdapter pagerAdapter;
LinearLayout L_view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pager);
//мой блок получаю курсор
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String id_for_listtsk_today = sdf.format(new Date());
ContentValues cv = new ContentValues();
DBHelper dbHelper = new DBHelper(this);
final SQLiteDatabase db = dbHelper.getWritableDatabase();
try {
c=dbHelper.getCursor(id_for_listtsk_today);
} catch (SQLException sqle) {
Log.d(Tag, "неудача");
throw sqle;
}
//String[] arr_date = logCursor(c);
c.close();
db.close();
pager = (ViewPager) findViewById(R.id.pager);
pagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager());
pager.setAdapter(pagerAdapter);
pager.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
Log.d(Tag, "onPageSelected, position = " + position);
}
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
/*@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}*/
private class MyFragmentPagerAdapter extends FragmentPagerAdapter {
public MyFragmentPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return PageFragment.newInstance(position);
}
@Override
public int getCount() {
return PAGE_COUNT;
}
@Override
public CharSequence getPageTitle(int position) {
return "Title " + position;
}
}
static String[] logCursor(Cursor c) {
// TODO Auto-generated method stub
final String Tag="States";
String[] arr_date = new String[c.getCount()];//String[] arr_date = new String[] {};
Log.d(Tag,"мы в курсоре");
if (c!=null) {
if (c.moveToFirst()) {
Log.d(Tag,"мы в курсоре1");
String str;
int i=-1;
do {
Log.d(Tag,"мы в курсоре2");
str="";
i=i+1;
for (String cn: c.getColumnNames()) {
str = str.concat(c.getString(c.getColumnIndex(cn)));
}
Log.d(Tag, "++++"+str);
arr_date[i]=String.valueOf(str);
} while (c.moveToNext());
}
}
return arr_date;
}
}
页面 fragment .java
public class PageFragment extends Fragment {
static final String ARGUMENT_PAGE_NUMBER = "arg_page_number";
int pageNumber;
int backColor;
final String Tag="States";
SQLiteDatabase db;
static Cursor c, c2;
ContentValues cv;
static int itemselected, id_itemselected;
final static int M_EDIT1 = 100;
final static int M_EDIT2 = 101;
final static int M_DELETE = 102;
final static int M_ADD = 103;
final static int M_REF = 104;
final static int D_EDIT = 200;
final static int D_DELETE = 201;
final static int D_ADD = 202;
ListView lvMain_today;
DialogFragment dlg1;
TextView tv;
static SimpleCursorAdapter scAdapter, scAdapter2;
MySqlCursorAdapter adapter = null;
static PageFragment newInstance(int page) {
PageFragment pageFragment = new PageFragment();
Bundle arguments = new Bundle();
arguments.putInt(ARGUMENT_PAGE_NUMBER, page);
pageFragment.setArguments(arguments);
return pageFragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pageNumber = getArguments().getInt(ARGUMENT_PAGE_NUMBER);
// dlg1 = new dialog_edit();
}
@Override
public boolean onContextItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case M_EDIT1:
dlg1.show(getFragmentManager(), "dlg1");
break;
case M_EDIT2:
Toast.makeText(getActivity(), "Изменение во втором списке", Toast.LENGTH_SHORT).show();
break;
case M_DELETE:
//dlg2.show(getFragmentManager(), "dlg2");
break;
case M_ADD:
break;
default:
return super.onContextItemSelected(item);
}
return true;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d(Tag, "onCreateView1");
View view = inflater.inflate(R.layout.activity_page_fragment, null);
lvMain_today = (ListView) view.findViewById(R.id.list);
//tv = (TextView) view.findViewById(R.id.tv);
Log.d(Tag, "onCreateView2");
OnCreateContextMenuListener occm1 = new OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
AdapterContextMenuInfo aMenuInfo = (AdapterContextMenuInfo) menuInfo;
itemselected = aMenuInfo.position;
id_itemselected = (int) aMenuInfo.id;
menu.add(Menu.NONE, M_EDIT1, Menu.NONE, "Изменить1");
menu.add(Menu.NONE, M_DELETE, Menu.NONE, "Удалить1");
menu.add(Menu.NONE, M_ADD, Menu.NONE, Integer.toString(id_itemselected));
}
};
Log.d(Tag, "onCreateView3");
OnCreateContextMenuListener occm2 = new OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
AdapterContextMenuInfo aMenuInfo = (AdapterContextMenuInfo) menuInfo;
itemselected = aMenuInfo.position;
id_itemselected = (int) aMenuInfo.id;
menu.add(Menu.NONE, M_EDIT2, Menu.NONE, "Изменить2");
menu.add(Menu.NONE, M_DELETE, Menu.NONE, "Удалить2");
menu.add(Menu.NONE, M_ADD, Menu.NONE, Integer.toString(id_itemselected));
}
};
switch (pageNumber){
case 0:
Log.d(Tag, "switch (pageNumber)1");
// DBase = new DataBase(getActivity());
// db = DBase.getWritableDatabase();
// c = db.query("items1", null, null, null, null, null, null);
case 1:
//пробуем*****
Log.d(Tag, "onCreateView4");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String id_for_listtsk_today = sdf.format(new Date());
ContentValues cv = new ContentValues();
DBHelper dbHelper = new DBHelper(getActivity());
final SQLiteDatabase db = dbHelper.getWritableDatabase();
Log.d(Tag, "onCreateView5");
try {
c=dbHelper.getCursor(id_for_listtsk_today);
} catch (SQLException sqle) {
Log.d(Tag, "неудача");
throw sqle;
}
String[] arr_date = Pager.logCursor(c);
//*************
Log.d(Tag, "onCreateView6");
getActivity().startManagingCursor(c);
int[] listFields = new int[] { R.id.txtTitle, R.id.textData1 };
String[] dbColumns = new String[] { DBHelper.COLUMN_NAME, DBHelper.COLUMN_TASK };
// Log.d(Tag, "трассировка" );
adapter = new MySqlCursorAdapter(
getActivity(), R.layout.my_list_item,
c, dbColumns, listFields,
dbHelper);
Log.d(Tag, "onCreateView7");
lvMain_today.setAdapter(adapter);
registerForContextMenu(lvMain_today);
lvMain_today.setOnCreateContextMenuListener(occm1);
db.close();
break;
// Log.d(Tag, "switch (pageNumber)2");
// DBase = new DataBase(getActivity());
// db = DBase.getWritableDatabase();
// c2 = db.query("items2", null, null, null, null, null, null);
// getActivity().startManagingCursor(c2);
// String[] from2 = new String[] {"item"};
// int[] to2 = new int[] {R.id.tvText};
// scAdapter2 = new SimpleCursorAdapter(getActivity(), R.layout.item, c2, from2, to2);
// lvMain.setAdapter(scAdapter2);
// lvMain.setOnCreateContextMenuListener(occm2);
// db.close();
// break;
}
return view;
}
}
MySQLCcursorAdapter.java
public class MySqlCursorAdapter extends SimpleCursorAdapter implements OnClickListener {
final String Tag="States";
private Context context;
private DBHelper dbHelper;
private Cursor currentCursor;
TextView txtTitle;
TextView txtTitle1;
final String needsAction="completed";
public MySqlCursorAdapter(Context context, int layout, Cursor c,
String[] from, int[] to, DBHelper dbHelper) {
super(context, layout, c, from, to);
//Log.d(Tag, "трассировка1" );
this.currentCursor = c;
this.context = context;
this.dbHelper = dbHelper;
//Log.d(Tag, "MySqlCursorAdapter()");
Integer b = c.getCount();
//Log.d(Tag, "b="+b);
}
public View getView(int pos, View inView, ViewGroup parent) {
Log.d(Tag, "getView() + posss=" + pos);
View v = inView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.my_list_item, null);
}
this.currentCursor.moveToPosition(pos);
CheckBox cBox = (CheckBox) v.findViewById(R.id.bcheck);
cBox.setTag(Integer.parseInt(this.currentCursor
.getString(this.currentCursor
.getColumnIndex(DBHelper.COLUMN_ID))));
//Log.d(Tag, "tag="+cBox.getTag().toString());
if (this.currentCursor.getString(this.currentCursor
.getColumnIndex(DBHelper.COLUMN_STATUS)) != null
&& String.valueOf(this.currentCursor
.getString(this.currentCursor
.getColumnIndex(DBHelper.COLUMN_STATUS))).equals(needsAction)) {
cBox.setChecked(true);
} else {
cBox.setChecked(false);
}
cBox.setOnClickListener(this);
txtTitle = (TextView) v.findViewById(R.id.txtTitle);
txtTitle1 = (TextView) v.findViewById(R.id.textData1);
txtTitle.setText(this.currentCursor.getString(this.currentCursor
.getColumnIndex(DBHelper.COLUMN_TIME))+" , "+this.currentCursor.getString(this.currentCursor
.getColumnIndex(DBHelper.COLUMN_NAME)));
txtTitle1.setText(this.currentCursor.getString(this.currentCursor
.getColumnIndex(DBHelper.COLUMN_TASK)));
if (cBox.isChecked())
{
//Log.d(Tag, " pos=" + pos);
txtTitle.setPaintFlags(txtTitle.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
txtTitle1.setPaintFlags(txtTitle1.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
}
else
{
//Log.d(Tag, "!pos=" + pos);
txtTitle.setPaintFlags(txtTitle.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
txtTitle1.setPaintFlags(txtTitle1.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
// txtTitle1.setSelected(true);
}
return (v);
}
public void ClearSelections() {
//Log.d(Tag, "ClearSelections()");
this.dbHelper.clearSelections();
this.currentCursor.requery();
}
@Override
public void onClick(View v) {
Log.d(Tag, "onClick(View v) в адаптере");
if(dbHelper.dbSqlite==null) {
//Log.d(Tag, "00000000000");
SQLiteDatabase db = dbHelper.getWritableDatabase();
//Log.d(Tag, "onClick");
CheckBox cBox = (CheckBox) v;
Integer _id = (Integer) cBox.getTag();
//Integer _id = 4;
//Log.d(Tag, "Integer _id="+_id.toString());
ContentValues values = new ContentValues();
values.put(" status", cBox.isChecked() ? "completed" : "needsAction");
try {
db.update("mytable", values, "_id = ?", new String[] { Integer.toString(_id) });
} catch (SQLException sqle) {
// Log.d(Tag, "неудача");
throw sqle;
}
}
}}
日志
06-10 09:23:52.437: D/States(5342): MainActivity: onDestroy()
06-10 09:23:52.460: D/States(5342): запустили службу ServiceUpdate
06-10 09:23:52.812: D/States(5605): onStartCommand
06-10 09:23:52.828: D/States(5605): onCreate
06-10 09:23:52.843: D/States(5605): Service onDestroy(). Stop AlarmManager at 2013-06-10 09:23:52.834
06-10 09:23:52.843: V/com.example.ok1.ServiceUpdate(5605): AlarmManger started at 2013-06-10 09:23:52.847
06-10 09:23:52.953: D/States(5342): getCursor() получаем курсор с базы
06-10 09:23:52.960: D/States(5342): getCursor() получили курсор с базы
06-10 09:23:53.031: D/States(5342): onCreateView1
06-10 09:23:53.078: D/dalvikvm(5342): GC_EXTERNAL_ALLOC freed 236K, 47% free 3103K/5767K, external 973K/1036K, paused 42ms
06-10 09:23:53.125: D/States(5342): onCreateView2
06-10 09:23:53.125: D/States(5342): onCreateView3
06-10 09:23:53.125: D/States(5342): switch (pageNumber)1
06-10 09:23:53.125: D/States(5342): onCreateView4
06-10 09:23:53.148: D/States(5342): onCreateView5
06-10 09:23:53.148: D/States(5342): getCursor() получаем курсор с базы
06-10 09:23:53.164: D/States(5342): getCursor() получили курсор с базы
06-10 09:23:53.164: D/States(5342): мы в курсоре
06-10 09:23:53.164: D/States(5342): onCreateView6
06-10 09:23:53.171: D/States(5342): onCreateView7
06-10 09:24:29.335: D/AndroidRuntime(5342): Shutting down VM
06-10 09:24:29.335: W/dalvikvm(5342): threadid=1: thread exiting with uncaught exception (group=0x40018578)
06-10 09:24:29.398: E/AndroidRuntime(5342): FATAL EXCEPTION: main
06-10 09:24:29.398: E/AndroidRuntime(5342): java.lang.NullPointerException
06-10 09:24:29.398: E/AndroidRuntime(5342): at com.example.ok1.PageFragment.onCreateView(PageFragment.java:191)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.view.ViewPager.populate(ViewPager.java:1064)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.view.ViewPager.populate(ViewPager.java:911)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1432)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.View.measure(View.java:8313)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.View.measure(View.java:8313)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.View.measure(View.java:8313)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.View.measure(View.java:8313)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.View.measure(View.java:8313)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.ViewRoot.performTraversals(ViewRoot.java:847)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.view.ViewRoot.handleMessage(ViewRoot.java:1867)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.os.Looper.loop(Looper.java:130)
06-10 09:24:29.398: E/AndroidRuntime(5342): at android.app.ActivityThread.main(ActivityThread.java:3687)
06-10 09:24:29.398: E/AndroidRuntime(5342): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 09:24:29.398: E/AndroidRuntime(5342): at java.lang.reflect.Method.invoke(Method.java:507)
06-10 09:24:29.398: E/AndroidRuntime(5342): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
06-10 09:24:29.398: E/AndroidRuntime(5342): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
06-10 09:24:29.398: E/AndroidRuntime(5342): at dalvik.system.NativeStart.main(Native Method)
06-10 09:24:32.070: W/jdwp(5342): Debugger is telling the VM to exit with code=1
我的列表项目.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#CCFFCC"
android:gravity="center_vertical"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/bcheck"
android:layout_width="62dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:focusable="false"
android:gravity="center_vertical|center_horizontal" />
<LinearLayout
android:layout_width="246dp"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:gravity="left|center_vertical"
android:maxLength="25"
android:text="Test"
android:textColor="#000000"
android:textSize="18dp"
android:textStyle="bold" />
<TextView
android:id="@+id/textData1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="false"
android:maxLength="40"
android:maxLines="1"
android:scrollHorizontally="true"
android:text="TextView"
android:textColor="#000000" />
</LinearLayout>
</LinearLayout>
寻呼机.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.PagerTabStrip
android:id="@+id/pagerTabStrip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top">
</android.support.v4.view.PagerTabStrip>
</android.support.v4.view.ViewPager>
</RelativeLayout>
activity_page_fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ListView
android:id="@+id/lvMain"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tv"
android:text="Запись 1">
</TextView>
</LinearLayout>
我做错了什么?
最佳答案
您正在使用
搜索您的 ListViewlvMain_today = (ListView) view.findViewById(R.id.list);
但在 activity_page_fragment.xml
中,id 是 android:id="@+id/lvMain"
。
因此访问您的 ListView 会在 lvMain_today.setAdapter(adapter);
请将布局 xml 中的 id 更改为 R.id.list。
也许这个tutorial帮助您理解堆栈跟踪。
关于android - 类 PageFragment 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17018966/
我最近在/ drawable中添加了一些.gifs,以便可以将它们与按钮一起使用。这个工作正常(没有错误)。现在,当我重建/运行我的应用程序时,出现以下错误: Error: Gradle: Execu
Android 中有返回内部存储数据路径的方法吗? 我有 2 部 Android 智能手机(Samsung s2 和 s7 edge),我在其中安装了一个应用程序。我想使用位于这条路径中的 sqlit
这个问题在这里已经有了答案: What's the difference between "?android:" and "@android:" in an android layout xml f
我只想知道 android 开发手机、android 普通手机和 android root 手机之间的实际区别。 我们不能从实体店或除 android marketplace 以外的其他地方购买开发手
自Gradle更新以来,我正在努力使这个项目达到标准。这是一个团队项目,它使用的是android-apt插件。我已经进行了必要的语法更改(编译->实现和apt->注释处理器),但是编译器仍在告诉我存在
我是android和kotlin的新手,所以请原谅要解决的一个非常简单的问题! 我已经使用导航体系结构组件创建了一个基本应用程序,使用了底部的导航栏和三个导航选项。每个导航选项都指向一个专用片段,该片
我目前正在使用 Facebook official SDK for Android . 我现在正在使用高级示例应用程序,但我不知道如何让它获取应用程序墙/流/状态而不是登录的用户。 这可能吗?在那种情
我在下载文件时遇到问题, 我可以在模拟器中下载文件,但无法在手机上使用。我已经定义了上网和写入 SD 卡的权限。 我在服务器上有一个 doc 文件,如果用户单击下载。它下载文件。这在模拟器中工作正常但
这个问题在这里已经有了答案: What is the difference between gravity and layout_gravity in Android? (22 个答案) 关闭 9
任何人都可以告诉我什么是 android 缓存和应用程序缓存,因为当我们谈论缓存清理应用程序时,它的作用是,缓存清理概念是清理应用程序缓存还是像内存管理一样主存储、RAM、缓存是不同的并且据我所知,缓
假设应用程序 Foo 和 Eggs 在同一台 Android 设备上。任一应用程序都可以获取设备上所有应用程序的列表。一个应用程序是否有可能知道另一个应用程序是否已经运行以及运行了多长时间? 最佳答案
我有点困惑,我只看到了从 android 到 pc 或者从 android 到 pc 的例子。我需要制作一个从两部手机 (android) 连接的 android 应用程序进行视频聊天。我在想,我知道
用于使用 Android 以编程方式锁定屏幕。我从 Stackoverflow 之前关于此的问题中得到了一些好主意,并且我做得很好,但是当我运行该代码时,没有异常和错误。而且,屏幕没有锁定。请在这段代
文档说: android:layout_alignParentStart If true, makes the start edge of this view match the start edge
我不知道这两个属性和高度之间的区别。 以一个TextView为例,如果我将它的layout_width设置为wrap_content,并将它的width设置为50 dip,会发生什么情况? 最佳答案
这两个属性有什么关系?如果我有 android:noHistory="true",那么有 android:finishOnTaskLaunch="true" 有什么意义吗? 最佳答案 假设您的应用中有
我是新手,正在尝试理解以下 XML 代码: 查看 developer.android.com 上的文档,它说“starStyle”是 R.attr 中的常量, public static final
在下面的代码中,为什么当我设置时单选按钮的外观会发生变化 android:layout_width="fill_parent" 和 android:width="fill_parent" 我说的是
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
假设我有一个函数 fun myFunction(name:String, email:String){},当我调用这个函数时 myFunction('Ali', 'ali@test.com ') 如何
我是一名优秀的程序员,十分优秀!