My friend I don't remember what the issue was, but it was certainly in C++ dll. And that is what I updated the original post/question. Please double check C++ dll. Checkout this video tutorial
Django_Untaken
Posts
-
[SOLVED] System.AccessViolationException When Calling Dll Function Again -
Are BroadcastReciever and ContentObserver killed If Started From Service?Hello all. 1- I register a BroadcastReciever in a service dynamically, and then start service. Now if app crashes or I stop service manually, will this also kill the BroadcastReceiver? 2- Same question for ContentObserver. I add ContentObserver for listening changes to addition/updation/deletion of contacts. Will this ContentObserver be also killed if somehow the service is destroyed Thanks for any input.
-
NullPointerException When Setting ClickListener on a RelativeLayoutIt is never null when I debug. It always finds a resource.
-
NullPointerException When Setting ClickListener on a RelativeLayoutHello there. I am setting a click listener on a relative layout. It works fine. But today I got couple of crashes on this
click listener
from the user. I set this click listener in the onCreate() function of the activity. Here is what my code looks like@Override
protected void onCreate(Bundle savedInstanceState) {
layoutHomeButton = findViewById(R.id.layoutHomeButton);
layoutHomeButton.setOnClickListener(new View.OnClickListener() { // ** <===exception here**
@Override
public void onClick(View view) {
// my code goes here
}
});
}And following is the exception I get
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3021)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3156)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1864)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:205)
at android.app.ActivityThread.main (ActivityThread.java:6991)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:884)
Caused by: java.lang.NullPointerException:
at com.hiclass.earthlivecam.publiccam.earthcam.webcamhd.ui.activities.ActivityPlayVideo.onCreate (ActivityPlayVideo.java:210)
at android.app.Activity.performCreate (Activity.java:7159)
at android.app.Activity.performCreate (Activity.java:7150)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3001)what am I doing wrong? Thanks :)
-
UnRegister BroadcastReceiver Dynamically While Exiting App throws IllegalArgumentExceptionHello there. I have this BroadcastReciever which I register and unregister dynamically, in a BASE activity. The purpose, of this receiver, is very simple. I check if HOME button is pressed? The registration of the receiver is as follows: ActivityBase
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHomeWatcher = new HomeWatcher(this); mHomeWatcher.setOnHomePressedListener(new OnHomePressedListener() { @Override public void onHomePressed() { // my code goes here } @Override public void onHomeLongPressed() { // my code goes here } }); mHomeWatcher.startWatch();
}
protected void stopHomeWatcher(){ if(mHomeWatcher != null) { mHomeWatcher.stopWatch(); mHomeWatcher.setOnHomePressedListener(null); mHomeWatcher = null; } }
HomeWatcher
public class HomeWatcher {
public HomeWatcher(Context context) {
mContext = context;
mFilter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
}public void setOnHomePressedListener(OnHomePressedListener listener) { mListener = listener; mReceiver = new InnerReceiver(); } public void startWatch() { if (mReceiver != null) { mContext.registerReceiver(mReceiver, mFilter); } }
/* EXCEPTION IN THIS FUNCTION */
public void stopWatch() {
if (mReceiver != null) {
if(mContext != null)
mContext.unregisterReceiver(mReceiver);// <<==========THIS IS WHERE I GET EXCEPTION
}
}class InnerReceiver extends BroadcastReceiver { final String SYSTEM\_DIALOG\_REASON\_KEY = "reason"; final String SYSTEM\_DIALOG\_REASON\_GLOBAL\_ACTIONS = "globalactions"; final String SYSTEM\_DIALOG\_REASON\_RECENT\_APPS = "recentapps"; final String SYSTEM\_DIALOG\_REASON\_HOME\_KEY = "homekey"; @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Intent.ACTION\_CLOSE\_SYSTEM\_DIALOGS)) { String reason = intent.getStringExtra(SYSTEM\_DIALOG\_REASON\_KEY); if (reason != null) { if(reason.trim().toLowerCase().equals("homekey")
-
Dialog with Landscape OrientationHello all. From out of 10 dialogs, I need one of the dialogs to start with landscape orientation. No other activity, fragment and dialog will be started with landscape orientation except this one dialog. I have absolutely no idea how do I make this happen? Do I create some custom control ? Thanks for any input.
-
Disable "Clear Cache" For My Android AppHello all. How can I disable "Clear Cache/Data" feature for my android app? Is that even possible? Thanks for any pointer.
-
Get Picture Coordinates Regardless of ScreenSizeHello there. I have written a code for 10" tablet with resolution of
2560 x 1600
and hardcoded values for it. The functionality is simple. I simply check whether current point on picture, in OnTouch event, lies in particular polygon or not. It works fine. But the problem is, I have hardcoded values and now I am given a 7" tablet with resolution of1200 x 1920
. And my code does not work for it because of changed resolution. How do I handle this? I don't want to hardcode another set of values for 7" tablet. Thanks NOTE: Picture resolution remains same1500 x 1501
pixels. -
video trackingTry vlcj and vlcj-player. But it is dependent on vlc.
-
Observer Pattern - Restart Thread Again When Exception OccursHello there. I am trying to implement
Observer Pattern
. I get notified, successfully, whenever a thread completes. I can start the same thread again when I get notified (through TaskListener I have implemented). But how do I start it again if there was some exception? Examplestatic MyWork objMyWork = null; // implements Runnable
static Thread objThread = null;public static void main(String[] args) throws
{
TaskListener listener = new TaskListener()
{
@Override
public void threadComplete()
{
try
{
objMyWork = new MyWork();
objMyWork.SetData1(int data);
objMyWork.SetData2(String data);
objMyWork.addListener(this);objThread = new Thread(objMyWork); objThread.start(); objThread.join(); } catch(Exception ex) { /\* HERE I WANT TO START THREAD AGAIN \*/ } } } objMyWork = new MyWork(); objMyWork.SetData1(int data); objMyWork.SetData2(String data); objMyWork.addListener(listener); objThread = new Thread(objMyWork); objThread.start(); objThread.join();
}
1- What changes do I make in
MyWork
so that control always comes back in the catch section ofTaskListener::threadComplete()
whenever there was exception? 2- Once control is there, how do I start this thread again (I dont want to nest another try-catch block and then another in the nested one and then another .... and so on). Thanks for anything you share :) -
java.net.SocketException: Software caused connection abort: socket write errorRichard MacCutchan wrote:
Well, as I suggested above, that is because the browser is not expecting it.
Perhaps I am having tough time understanding you. Please bear with me. To the best of my knowledge, I am sending only the images and nothing else. I also tried removing the header just before I transmit the image, even that does not help. :(
-
java.net.SocketException: Software caused connection abort: socket write errorRichard MacCutchan wrote:
So your 'client' should be a server .....
- I have a 'ServerThread' (one and only one server thread) - The piece of code that serves images, upon request, is known as 'ClientThread' - This 'ServerThread' can start
N
number of 'ClientThread', againstN
number of requests from web browser. And YES. Good naming conventions help understand better. 'ClientThread' could better be named as 'RequestThread'. But the problem still remains. My browser display ONE picture, sent from my server. After that ONE picture, it starts throwing said exception. -
java.net.SocketException: Software caused connection abort: socket write errorHello there. I am trying to send images (byte[] data) to web browser using java. I am doing this in a
while(true)
loop. MyClientThread
sends one image only. After that, it starts producing this exception. Here is what I have tried so farOverview
1- MainThread starts ServerThread
2- ServerThread start ClientThread
3- ClientThread has a loop. In this loop, I read next image and pass it to MovieWriter (which writes it to DataOutputStream of clientSocket) with a delay of 50msclass ClientThread extends Thread
{
@Overrie
public void run()
{
OutputStream outStream = clientSocket.getOutputStream(); // clientSocket = class variable
DataOutputStream dataOutStream = new DataOutputStream(outStream);MovieWriter mv = new MovieWriter(dataOutStream); mv.WriterHttpHeader(); while(true) { Thread.sleep(50); ByteArrayOutputStream image = ReadImage.GetNext(); // 'ReadImage' is static class which returns the next image mv.WriteNextImage(image.toByteArray()); }
}
}class MovieWriter
{
public MovieWriter(DataOutputStream)
{
// set class variable
}public void WriterHttpHeader()
{
String header = "HTTP/1.1 200 OK \r\n Content-Type: multipart/x-mixed-replace; boundary=--boundary";
dataOutputStream.write(GetBytes(header)); // dataOutputStream = class variable; GetBytes() return bytes of header
}public void WriteNextImage(byte[] data)
{
try
{
String response = "Content-Type: image/jpg \r\n" + "Content-Length: " + String.ValueOf(data.length);
dataOutputStream.write(GetBytes(response)); // first write response header
dataOutputStream.write(data); // then write image data
} catch(Exception ex) {
ex.printStackTrace();
}
}}
Again, when the while loop in
ClientThread
runs,MovieWriter
sends one image only. After that, it raises the said exception. What am I doing wrong? Thanks for anything you share :) NOTE: I cut this code short for better understanding. If you need more code, I can provide -
Configure Remote Machine's IP in C# Service At Install TimeHi there. I have following scenario - one machine with a service installed (machine 1) - one remote machine with public ip (machine 2) - one machine with web application (machine 3) All these machines could be in the same premises or in different. Since all of these machines and their respective software could be installed in any order, I don't know how to get machine 2's IP. Because my service on machine 1 will use this IP to upload data to it. And, of course, web application on machine 3 will display this data. Any idea what API/library could I use on machine 1 to recieve machine 2's IP? Thanks for anything you share.
-
Find File Upload URL (Gmail/Yahoo/Outlook) using WiresharkHello there. I am trying to find upload URL of any of the above email providers using wireshark. I have tried the following filter and tried to see where I go but in vein.
ip.addr == MY_IP_ADDRESS && http
I have tried to
Follow TCP Stream
,Follow HTTP Stream
on several http packets but, again, I could not find the upload url of a file. How do I find file upload URL of any of the above email providers? Thanks for any input. -
How To Add New Code - NetBeansHello all... I have this C code which I can compile and modify using NetBeans. But problems come when I try to separate some of the code to new files (.h & .c). I get these
Unresolved External Symbols xxxxx
. Example/*newFile.h*/
int add(int a, int b);/*newFile.c*/
int add(int a, int b)
{ return a + b; }/*main.c*/
#include "newFile.h"
int main()
{
int result = add(5,6); // this is where I get said error
_getch();
return 0;
}How do I overcome this error....thanks for anything you share.
-
Array of char*Jochen Arndt wrote:
How to do that depends if you are using C or C++:
Well I should have mentioned that earlier..... I am using C. Can you please edit your question (or append the code for C)
-
Array of char*Hello all... how do I create array of
char*
. At the moment I have hardcoded the number of instances (large enough to hold tokens) but this should be generic. Exampleint temp_array[2] = {0};
char* token1;
char* token2;As you can see, I might not know how many tokens I need at run time. I want something like this
char* [] tokens;
How could I fix this? Thanks
-
[solved] Declare & Use Gobal Variable in C (Just like Singleton Variable)Thanks. I got it working. But the log file is not getting updated until I close my program. How do I update the log file even when the program is running?
-
[solved] Declare & Use Gobal Variable in C (Just like Singleton Variable)Hello all. I am trying to re-use a file pointer at the start of the program and then close this when program is shutting down, after some work with it. So far I have come up with this
globals.h
extern FILE* ptrLogFile;
file1.c
#include "globals.h"
FILE* ptrLogFile = fopen("RequestsLog.log", "a+");file2.c
#include "globals.h"
FILE* ptrLogFile = fopen("RequestsLog.log", "a+");file3.c
#include "globals.h"
fclose(ptrLogFile);
But this is not what I am looking for. I want to initialize, using
fopen()
, theptrLogFile
just once (may be inglobals.h
?) and then re-use it infile1.c
andfile2.c
as long as I want. Finally close it in file3.c when the program is shutting down. How do I do this? Thanks