我被卡住了.当我的应用程序启动时,我想检查我之前设置的警报是否存在.如果没有,那么我想设置它.
我提到了这个解决方案.我试图匹配这样的意图:
Intent intent = new Intent();
intent.setAction("com.vit.upload");
PendingIntent pIntent = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_NO_CREATE);
Run Code Online (Sandbox Code Playgroud)
但它不起作用.还有什么工作?
我创建了一个由ViewSwitcher组成的广告控件....
在该控件中我有ImageView和TextView,因为广告是文本或图像..
现在我必须给advetisements动画..
我试过以下
动画inAnimation = AnimationUtils.loadAnimation(this,android.R.anim.slide_in_left); inAnimation.setDuration(1500);
动画outAnimation = AnimationUtils.loadAnimation(this,android.R.anim.slide_out_right); outAnimation.setDuration(1500);
我把它设置为切换台
ViewSwitcher切换器;
switcher.setInAnimation(inAnimation);
switcher.setOutAnimation(outAnimation);
但它不会工作..
请给我任何其他选择..或者如果使用上面的代码是错误的,那么如何使用它?
我有如下创建的"天"表
"create table days(" +
"day_id integer primary key autoincrement, " +
"conference_id integer , " +
"day_date text, " +
"day_start_time text, " +
"day_end_time text, " +
"day_summary text, " +
"day_description text)";
Run Code Online (Sandbox Code Playgroud)
我有如下创建的轨道表
CREATE_TABLE_TRACK = "create table track(" +
"track_id integer primary key autoincrement," +
"day_id integer,"+
"track_name text," +
"track_description text," +
" FOREIGN KEY(day_id) REFERENCES days(day_id) ON DELETE CASCADE )";
Run Code Online (Sandbox Code Playgroud)
如上所示,我有外键day_id引用表天的day_id ...
所以我想要的是,如果我删除那一天,那么相应的轨道也应该被删除...但它不会发生在我的情况下..
我有版本3.5.9的 sqlite
而且我在我的帮助类中添加了一行作为
> db.execSQL("PRAGMA foreign_keys = ON;");
但仍然无法工作..请帮帮我..
我正在开发位置跟踪应用程序.但我停止通过做两件事来获得位置更新......
这将停止获得我想要的位置坐标...
但问题是gps图标仍在闪烁..这将耗尽设备的电池.
所以请帮我停止这个GPS修复...
我试图通过xml创建我的自定义视图,但屏幕不显示我的视图,它没有膨胀.我的自定义视图xml如下:
<?xml version="1.0" encoding="utf-8"?>
<ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/profileSwitcher"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/imgAdvertise"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@android:drawable/btn_minus" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:id="@+id/txtAdvertise"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="asdas" />
</LinearLayout>
</ViewSwitcher>
Run Code Online (Sandbox Code Playgroud)
我有我的自定义View类:
public class MyCustomView extends View{
TextView textAdvertise;
ImageView imageAdvertise;
View view;
ViewSwitcher switcher ;
public MyCustomView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (layoutInflater != null) {
view = layoutInflater.inflate(R.layout.main, null);
} …Run Code Online (Sandbox Code Playgroud) 当我按下Android的主页按钮并开始新的活动时,我正面临一些奇怪的问题.
我的堆栈跟踪如下
05-13 18:06:21.182: E/FragmentManager(5674): Failure saving state: active Fragment{411d96d8} has cleared index: -1
05-13 18:06:21.182: E/FragmentManager(5674): Activity state:
05-13 18:06:22.032: E/ACRA(5674): ACRA caught a IllegalStateException exception for com.itgurussoftware.android.dineback. Building report.
05-13 18:06:27.732: E/ACRA(5674): com.itgurussoftware.android.dineback fatal error : Failure saving state: active Fragment{411d96d8} has cleared index: -1
05-13 18:06:27.732: E/ACRA(5674): java.lang.IllegalStateException: Failure saving state: active Fragment{411d96d8} has cleared index: -1
05-13 18:06:27.732: E/ACRA(5674): at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1723)
05-13 18:06:27.732: E/ACRA(5674): at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:546)
05-13 18:06:27.732: E/ACRA(5674): at android.app.Activity.performSaveInstanceState(Activity.java:1113)
05-13 18:06:27.732: E/ACRA(5674): at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1185) …Run Code Online (Sandbox Code Playgroud) 嗨guyzz我有TabActivity跟随简单的代码
public class TabhostActivity extends Activity{
TabHost host;
public class TabhostActivity extends Activity{
TabHost host;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.tablayout);
host = (TabHost) findViewById(R.id.mytabhost);
host.setup();
Intent intent = new Intent(getApplicationContext(), RatingBarActivity.class);
TabHost.TabSpec spec = host.newTabSpec("positions").setIndicator("Positions",getResources().getDrawable(R.drawable.add)).setContent(intent);
host.addTab(spec);
host.setCurrentTab(0);
}
Run Code Online (Sandbox Code Playgroud)
并有一个简单的标签布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabHost
android:id="@+id/mytabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#FF0000">
</FrameLayout>
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TabWidget …Run Code Online (Sandbox Code Playgroud) 我得到了跟踪堆栈跟踪
04-17 12:11:56.378: D/ATRecorder(10379): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader@40528b78
04-17 12:11:56.408: D/WindowManagerImpl(10379): addView, new view, mViews[0]: com.android.internal.policy.impl.PhoneWindow$DecorView@40520738
04-17 12:11:56.428: D/WindowManagerImpl(10379): addView, new view, mViews[1]: android.widget.LinearLayout@40525d00
04-17 12:11:56.438: D/WindowManagerImpl(10379): finishRemoveViewLocked, mViews[1]: android.widget.LinearLayout@40525d00
04-17 12:11:56.718: D/TAG(10379): Error setting camera preview: setPreviewDisplay failed
04-17 12:11:56.748: D/TAG(10379): Error starting camera preview: setPreviewDisplay failed
04-17 12:12:07.558: D/View(10379): onTouchEvent: viewFlags: 0x18004001
04-17 12:12:07.568: D/View(10379): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false
04-17 12:12:07.588: V/MediaRecorderJNI(10379): start
04-17 12:12:07.598: V/MediaRecorderJNI(10379): getMediaRecorder E
04-17 12:12:11.632: V/MediaRecorderJNI(10379): process_media_recorder_call
04-17 …Run Code Online (Sandbox Code Playgroud) 
嗨朋友想要删除出现在微调器上的单选按钮..这是增加我的对话框的布局大小..在此先感谢..
我正在使用 TextView 在两行中编写文本描述。我正在使用android:gravity="center"居中对齐两行并在 xml 文件中使用android:maxLines="2"&android:ellipsize="end"属性。第一行正常,但在第二行的左侧文本被剪裁了。如果我删除android:ellipsize="end"属性,则没有任何文本剪切。所以我想我的问题是因为 ellipsize 属性。我尝试了很多实验来解决这个问题,但都没有成功。谁能帮我解决我的问题。
我试图设置同步和非同步方法之间的区别..我试过以下代码
class Counter {
private int counter = 10;
public int getCounter() {
return counter;
}
public synchronized void doIncrementAndDecrement() {
counter++;
keepBusy(500);
counter--;
}
public void keepBusy(int howLong) { // (D)
long curr = System.currentTimeMillis();
while (System.currentTimeMillis() < curr + howLong)
;
}
}
class MyCounterThread extends Thread {
Counter c;
public MyCounterThread(Counter c, String name) {
// TODO Auto-generated constructor stub
super(name);
this.c = c;
start();
}
@Override
public void run() {
for (;;) {
c.doIncrementAndDecrement();
sleepForSometime();
System.out.println(c.getCounter()); …Run Code Online (Sandbox Code Playgroud) 我是android开发的初学者.我正在努力使吐司工作,但我发现代码没有任何问题.
这是xml代码.
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="horizontal" >
<ImageView
android:id="@+id/topbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/dravaka_dark" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#3333" >
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="20dp"
android:gravity="left"
android:orientation="vertical"
android:paddingTop="10dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" >
<ImageView
android:id="@+id/about_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="10dp"
android:layout_marginLeft="20dp"
android:scaleType="fitXY"
android:src="@drawable/about_icon" />
<TextView
android:id="@+id/about_tab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:clickable="true"
android:text="@string/about_title"
android:textSize="25sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" >
<ImageView
android:id="@+id/schedule_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="10dp"
android:scaleType="fitXY"
android:src="@drawable/schedule_icon" />
<TextView
android:id="@+id/schedule_tab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:clickable="true" …Run Code Online (Sandbox Code Playgroud)