Well either its a revolutionary break-through or you haven't got what the
problem is because its working now.

The crashing problem was with the eclipse IDE..it was crashing If I put a
break point anywhere in my threads.

There is some stupid problem which vanishes if you remove "Unused Imports"
from your code. And this happens on arbitrary basis, I have implemented and
debugged my code earlier with loads of "Unused Imports".



On Wed, Jul 18, 2012 at 8:46 PM, Kristopher Micinski <[email protected]
> wrote:

> Also, if your thread is crashing, you should do an 'adb logcat' and
> post the relevant stack trace relevant to the crash.
>
> kris
>
> On Wed, Jul 18, 2012 at 11:15 AM, Kristopher Micinski
> <[email protected]> wrote:
> > I'm not sure what you're going after, and you haven't said very well..
> >
> > In any case, "extending" your app is pretty hard.  You say that you
> > want to distribute the code for your app, in a third party jar, that
> > the users won't have access to?  Is this because you don't want your
> > code to get taken?  If so, then there is absolutely no way this is
> > possible.  If the vm is running the code, then someone can access it.
> > Imagine, for example, a hacked vm that simply dumps the code it's
> > executing to foil whatever plans you have.  (This is easily done, by
> > the way, ...)
> >
> > If you don't want the user to see your code, your only option is to
> > run that code somewhere else.  I.e., on a remote server...
> >
> > kris
> >
> > On Wed, Jul 18, 2012 at 3:44 AM, Harsh Vardhan <[email protected]>
> wrote:
> >> Hey,
> >>
> >> I have an interface called IFunctionDictionary which has a function
> called
> >> Execute. In my main thread run() function I register few functions and
> there
> >> corresponding key/command. In the same function I wait for key From
> socket
> >> and when I receive it I call the interface function Execute() which
> intern
> >> implements behavior  in the main thread  Execute Function definition.
> >>
> >> I have run into a bump here:
> >>
> >> In my main thread run() function I register the key and the function in
> a
> >> hash map.
> >>
> >> public void run()
> >>
> >> {
> >>
> >> _this = this;
> >>
> >>
> >> try
> >>
> >> {
> >>
> >>
> FunctionDictionary.RegisterFunction(String.valueOf(CONSTANTS.INITIALIZE),
> >> new IFunctionDictionary()
> >>
> >> {
> >>
> >> public void Execute()
> >>
> >> {
> >>
> >> _this.m_init();
> >>
> >> }
> >>
> >> });
> >>
> >>
> >>
> >>                                 this.m_localServerSocket = new
> >> ServerSocket(InitializeTeacherJar.getLocalPort());
> >>
> >> this.m_localServerSocket.setReuseAddress(true);
> >>
> >> this.m_localServerSocket.setSoTimeout(100000);
> >>
> >> this.m_localSocket = m_localServerSocket.accept();
> >>
> >> while (true)
> >>
> >> {
> >>
> >> ApplicationLog.log("Flex Listener Thread Started:: Waiting for Server
> >> Socket", true);
> >>
> >> if (this.m_localSocket != null)
> >>
> >> ApplicationLog.log("Flex Thread:: Flex socket created at port no:",
> true);
> >>
> >> try
> >>
> >> {
> >>
> >> BufferedReader in = new BufferedReader(new
> >> InputStreamReader(this.m_localSocket.getInputStream()));
> >>
> >> line = null;
> >>
> >> while ((line = in.readLine()) != null)
> >>
> >> {
> >>
> >> this.m_command = line;
> >>
> >> this.m_commandParameters = this.m_command.split("#");
> >>
> >> FunctionDictionary.Execute(this.m_commandParameters[0]);
> >>
> >> }
> >>
> >> }
> >>
> >> catch (Exception e)
> >>
> >> {
> >>
> >> ApplicationLog.log("Exception Flex Listener Process Command" +
> >> e.getMessage(), true);
> >>
> >> }
> >>
> >> }
> >>
> >> }
> >>
> >> catch (Exception e)
> >>
> >> {
> >>
> >> ApplicationLog.log("Exception Flex Listener Thread: cant create server
> >> socket." + e.getMessage(), true);
> >>
> >> }
> >>
> >> }
> >>
> >>
> >> The m_init gets called when I receive the key from socket.
> >>
> >> private void m_init()
> >>
> >> {
> >>
> >> if (_this.m_isInitialized)
> >>
> >> return;
> >>
> >> else
> >>
> >> {
> >>
> >> try
> >>
> >> {
> >>
> >> InitializeTeacherJar.instantiate(_this.m_command.split("#")[1],
> >> _this.baseContext, _this.m_command.split("#")[2]);
> >>
> >> _this.m_parent = InitializeTeacherJar.getInstance();
> >>
> >> _this.m_parent.setMyFlexServer(_this.m_localServerSocket);
> >>
> >> _this.m_parent.setMyFlexSocket(_this.m_localSocket);
> >>
> >>
> >> _this.m_isInitialized = true;
> >>
> >> }
> >>
> >> catch (Exception e)
> >>
> >> {
> >>
> >> //Log it
> >>
> >> }
> >>
> >> }
> >>
> >> }
> >>
> >>
> >>  The mechanism it self is fine, no bugs, no crash. But when I come to
> the
> >> Ist line of the m_init function the thread crashes abruptly.
> >>
> >> Is there something missing...!!
> >>
> >>
> >> On Tue, Jul 17, 2012 at 5:02 PM, Harsh Vardhan <[email protected]>
> >> wrote:
> >>>
> >>> Thanks Ali.
> >>>
> >>> I am aware of the what the design patterns are, what i needed to know
> is
> >>> which one hits the spot in my case. Anyways I have gone ahead with
> something
> >>> that I have figured after some head scratching and will let you all
> know if
> >>> i succeed.
> >>>
> >>>
> >>>
> >>>
> >>> On Tue, Jul 17, 2012 at 12:42 PM, Ali Chousein <[email protected]
> >
> >>> wrote:
> >>>>
> >>>> You cannot extend case statements in your code dynamically, but take a
> >>>> look at the strategy design pattern
> >>>> (http://en.wikipedia.org/wiki/Strategy_pattern). I think that's what
> you
> >>>> need. Design patterns are not Android specific by the way, they are
> just a
> >>>> set of best practices in designing software.
> >>>>
> >>>> -------------------------------------------------
> >>>> Ali Chousein
> >>>> https://play.google.com/store/apps/details?id=com.apps.social_nav
> >>>> https://play.google.com/store/apps/details?id=com.apps.weather_buddy
> >>>> http://www.paygol.com/android/implementation
> >>>>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Android Developers" group.
> >>>> To post to this group, send email to
> [email protected]
> >>>> To unsubscribe from this group, send email to
> >>>> [email protected]
> >>>> For more options, visit this group at
> >>>> http://groups.google.com/group/android-developers?hl=en
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> Regards
> >>> Harsh Vardhan
> >>>
> >>
> >>
> >>
> >> --
> >> Regards
> >> Harsh Vardhan
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Android Developers" group.
> >> To post to this group, send email to
> [email protected]
> >> To unsubscribe from this group, send email to
> >> [email protected]
> >> For more options, visit this group at
> >> http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Regards
Harsh Vardhan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to