Android Notification在应用程序启动时触发

我正在尝试让我的每日通知服务正常工作,但我遇到了问题。 我应该只在将来的某个特定时间收到通知,但我注意到了 if (time_that_i_set_for_notification < current_time_of_the_day) notification triggers at the boot of my app 这是错误的,因为在这种情况下,通知应该仅在第二天触发,而不是在我启动应用程序的瞬间。 这是我试图让事情奏效的尝试: 我在我的MainActivity,onCreate()方法中调用它 : private void scheduleNotification(int hour, int minute){ Intent notificationIntent = new Intent(this, NotificationReceiver.class); notificationIntent.putExtra(“notifId”, notifId); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, notifId, notificationIntent, 0); // Set the alarm to start at approximately at a time DatePicker datePicker = new DatePicker(this); […]

java中的video隐写术

我正在为我的项目实施video隐写术。 我从这里看到了算法。 我已经尝试并测试了代码,嵌入部分工作正常。 但我遇到了readByte的问题,这是VideoSteganography类中的最后一个方法。 该方法给出了ArrayIndexOutOfBoundsException 。 以下是方法。 我将参数传递给 String fname = jTextField3.getText(); File fil = new File(fname); String password = “123456”; SteganoInformation cls = new SteganoInformation(fil); VideoSteganography.retrieveFile(cls, password, true); 而方法是 public static boolean retrieveFile(SteganoInformation info, String password, boolean overwrite) { File dataFile= null; features= info.getFeatures(); try { masterFile= info.getFile(); byteArrayIn= new byte[(int) masterFile.length()]; DataInputStream in= […]

在AsyncTask的情况下,在doInBackground()方法之前调用onPostExecute()

考虑以下代码: package com.reallybelievebig.asynctaskextracredit; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class AsyncTaskTestActivity extends AppCompatActivity { private static final String TAG = AsyncTaskTestActivity.class.getSimpleName(); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_async_task_test); new TestTask().execute(“Execute”); Log.d(TAG, “In UI Thread!”); } private class TestTask extends AsyncTask { @Override […]

如何在JFrame中的JPanel中添加ChartPanel

我一直试图这样做.. JFreeChart chart = createChart(createDataset()); jPanel1 = new ChartPanel(chart, false); 这个JPanel1在JFrame里面(它是一个Netbeans的JFrameforms,所以我有一些标签和textAreas) jPanel1固定在Netbeans的设计者里面…在做了其他数据工作之后的某个地方我现在想要一个关于数据的所有文本的数据图表。 我尝试了其他解决方案,比如将JFreeChart转换为jPanel。 也 JFreeChart chart = createChart(createDataset()); JChartPanel P=new ChartPanel(chart,false); jPanel1.add(P); 实际代码: public class NucleotideComposition extends JFrame{ public NucleotideComposition(String filename) { DNA dna=new DNA(filename); int count moleculeName.setText(dna.getSeq_name()); Length.setText(Integer.toString(count = dna.length())); JFreeChart chart = createChart(createDataset(dna.countA(),dna.countT,dna.Countc,dna.countG)); jPanel1 = new ChartPanel(chart, false); } private static PieDataset createDataset(int […]

Lotus Notes的完全访问管理模式

我正在为lotus notes代理编写一个远程java代理。 我需要访问一些对帐户有限制的注释。 我的客户建议使用“完全访问管理”模式来查看这些文档,因为不允许更改注释。 在搜索IBM的api文档后,我没有看到任何方法可以打开完全访问管理模式。 有谁知道如何连接到Lotus Notes服务器作为“完全访问管理”模式? 只是想澄清一下,我正在使用diiop来访问Lotus Notes服务器。 因此,我需要通过diiop函数调用激活完全访问模式。

Java在arraylist中查找值

我在arraylist中添加了一些数字。 我想从它找到一定的值。例如我有4,4,9,9,18。 我想找到26的值。如果列表中26>最大值它将显示18,如果值为17,它将显示9,如果值为5,它将显示4.还有另一种方法来实现这个搜索,因为class轮搜索可能会很慢。 search value 26 [4,4,9,9,18] display 18 [20,20,29,29,4] display 20 [28,28,28,1,10] display 28 如果你有这个列表并搜索26,它将输出第一个元素。 因为第一个元素<=比搜索的值。 但目前的输出是 价值2:9 public class Arraylist { public static ArrayList aList; public static void main(String[] args) { aList = new ArrayList(); aList.add(4); aList.add(4); aList.add(9); aList.add(9); aList.add(18); int value = 26; int value2 = 0; for (int i = 0; […]

在Java中工作的隐式inheritance

任何人都可以告诉我隐式inheritance如何在java内部工作? 我的意思是,如果我创建一个类,它究竟是如何扩展JVM中的Object类的? 提前致谢。

使用分隔每个条目的线条在toString中打印Arraylist

我有一个需要打印很多东西的toString,包括一个包含多个条目的Arraylist。 这些条目必须用新行分隔。 这是我正在使用的toString代码: @Override public String toString() // Displays the info for a class { return getCourseId() + “\n” + getCourseName() + “\n” + getCourseCode() + “\n” + “\n” + “Instructor” + “\n” + “————————-” + “\n” + Instructor.toString() + “\n” + “\n” + “Student Roster” + “\n” + “————————-” + “\n” + roster; } […]

从Activity中调用ViewPager中当前Fragment的方法

我在Android应用程序中监听网络活动。 当事件通过网络传来时,我想更新一些驻留在我的应用程序中不同片段内的TextView。 现在我有一个单一的屏幕应用程序,一次在屏幕上有一个片段。 如何在由FragmentStatePagerAdapter管理的ViewPager内部的现有Fragment上调用方法? 我能够正确地“绘制”UI,它按预期显示在屏幕上。 这一切都有效。 我正在努力做的是在后台线程向我的包含Activity发送消息时调用方法。 该线程长时间运行并将频繁更新每个TextView(想想倒计时器)。 {thread} – > Actvity.handleMessage() – > {current} Fragment.update(); 我试图辨别“当前”,屏幕上的片段是什么,以便我可以调用它上面的方法来更新其TextViews。 我试图使用我读过的findFragmentByTag方法,但它总是返回一个空的Fragment对象。 具体来说,我这样做: private String getFragmentTag(int viewPagerId, int fragmentPosition){ return “android:switcher:” + viewPagerId + “:” + fragmentPosition; } //Take the data from the thread (network) and react to it. @Override public boolean handleMessage(Message msg) { //tell the fragment to […]

Lucene:首先不显示完全匹配

我正在使用演示IndexFiles和SearchFiles类来索引和搜索org.apache.lucene.demo数据包中的内容。 我的问题是当我使用包含多个单词的查询时,我没有得到具有完全匹配的结果。 例如: Enter query: “natural language” Searching for: “natural language” 298 total matching documents 1. download\researchers.uq.edu.au\fields-of-research\natural-language-processing .txt 2. download\researchers.uq.edu.au\research-project\16267.txt 3. download\researchers.uq.edu.au\research-project\16279.txt 4. download\researchers.uq.edu.au\research-project\18361.txt 5. download\www.uq.edu.au\news\%3Farticle%3D2187.txt 6. download\researchers.uq.edu.au\researcher\2115.txt 7. download\ceit.uq.edu.au\content\2013-2014-summer-research-scholarship-project s-dr-alan-cody%3Fpage%3D1.txt 8. download\ceit.uq.edu.au\content\2013-2014-summer-research-scholarship-project s-dr-alan-cody%3Fpage%3D2.txt 9. download\ceit.uq.edu.au\content\2013-2014-summer-research-scholarship-project s-dr-alan-cody.txt 10. download\www.ceit.uq.edu.au\content\2013-2014-summer-research-scholarship-pr ojects-dr-alan-cody.txt Press (n)ext page, (q)uit or enter number to jump to a page. 没有相同的结果: Enter query: […]