HELP!! int to byte array!

by Rodrigo Platero » Fri, 20 May 2011 09:30:36 GMT

Sponsored Links

I need help! I need convert an int to a byte array, and i don't get it!!


PD: Sorry my english :S
Rodrigo Platero Montero


Re: HELP!! int to byte array!

by Miguel Morales » Fri, 20 May 2011 09:41:31 GMT 

On Thu, May 19, 2011 at 2:25 AM, Rodrigo Platero

~ Jeremiah:9:23-24
Android 2D MMORPG: , 


Sponsored Links

Other Threads

1. Android.view.InflateException: Binary XML file line #7

<My Activity>
    public void onCreate(Bundle savedInstanceState) {

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="

When first run, there is no problem.
If I touch screen, Screen Orientation call
Display landsacpe orientation (So far there is no problem.)

and then, If I touch screen again, I will expect the Screen
Orientation call
But this time, error occur.
Force close!!

error in onCreate();
setContentView(R.layout.main); error: Android.view.InflateException:
Binary XML file line #7

I don't know solution....

help me.


2. struct ip6_tnl_net? register_netdev(ip6n->fb_tnl_dev) failed?


I need to port some code from linux kernel 2.6.18 to kernel 2.6.29.
One of the file where changes are involved is <net/ipv6/ip6_tunnel.c>,
where a new structure struct ip6_tnl_net was added into kernel2.6.29
that didn't exist in 2.6.18 as follows:

struct ip6_tnl_net {
        /* the IPv6 tunnel fallback device */
        struct net_device *fb_tnl_dev;
        /* lists for storing tunnels in use */
        struct ip6_tnl *tnls_r_l[HASH_SIZE];
        struct ip6_tnl *tnls_wc[1];
        struct ip6_tnl **tnls[2];

All those fields in struct ip6_tnl_net were in global namespace in
2.6.18, but wrapped in this struct for some reason (what benefit does
this gain?)

2.6.18 code in function ip6_tunnel_init() works fine as follows. After
being ported to kernel 2.6.29 as shown below, after kernel/module
build, install, reboot hangs. I inserted some printk message as shown,
only 111111 to 44444 were displayed, which indicates that
"register_netdev(ip6n->fb_tnl_dev)" failed.

Any inputs? Thanks.

====================Kernel 2.6.18 code, works fine====================
static int __init ip6_tunnel_init(void)
        int  err;
    struct  ip6_tnl *tun0;

        if (xfrm6_tunnel_register(&ip6ip6_handler)) {
                printk(KERN_ERR "ip6ip6 init: can't register tunnel\n");
                return -EAGAIN;
        ip6ip6_fb_tnl_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6tnl0",

        if (!ip6ip6_fb_tnl_dev) {
                err = -ENOMEM;
                goto fail;
        ip6ip6_fb_tnl_dev->init = ip6ip6_fb_tnl_dev_init;

        if ((err = register_netdev(ip6ip6_fb_tnl_dev))) {
                goto fail;
    tun0 = ip6ip6_fb_tnl_dev->priv;
    tun0->parms.flags |= (IP6_TNL_F_CAP_XMIT | IP6_TNL_F_CAP_RCV);
        return 0;
        return err;

=================modified Kernel 2.6.29 code, buggy==============
static int __init ip6_tunnel_init(void)
        int err;
        struct ip6_tnl_net *ip6n; /*added due to kernel struct change*/
        struct ip6_tnl *tun0;   /*added 06082010*/

        if (xfrm6_tunnel_register(&ip4ip6_handler, AF_INET)) {
                printk(KERN_ERR "ip6_tunnel init: can't register ip4ip6\n");
                err = -EAGAIN;
                goto out;

        if (xfrm6_tunnel_register(&ip6ip6_handler, AF_INET6)) {
                printk(KERN_ERR "ip6_tunnel init: can't register ip6ip6\n");
                err = -EAGAIN;
                goto unreg_ip4ip6;

        err = register_pernet_gen_device(&ip6_tnl_net_id, &ip6_tnl_net_ops);
        if (err < 0)
                goto err_pernet;
        printk(KERN_ERR "=========1111111111111111111========\n");

        //alloc_netdev() and init the device, added
        err = -ENOMEM;
        ip6n = kzalloc(sizeof(struct ip6_tnl_net), GFP_KERNEL);
        if (ip6n == NULL)
                goto out;

        ip6n->fb_tnl_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6tnl0",
        printk(KERN_ERR "=======222222222222222222=========\n");
        if (!ip6n->fb_tnl_dev) {
                err = -ENOMEM;
                goto out;
printk(KERN_ERR "=========3333333333333333333========\n");

        ip6n->fb_tnl_dev->init = ip6_fb_tnl_dev_init2;
printk(KERN_ERR "=========4444444444444444444========\n");

        err = register_netdev(ip6n->fb_tnl_dev);
        if (err<0) {
                goto err_pernet;
printk(KERN_ERR "=========555555555555555555========\n");

//      tun0 = ip6ip6_fb_tnl_dev->priv;         /*added per patch*/
        tun0 = netdev_priv(ip6n->fb_tnl_dev);   /*modified  */
printk(KERN_ERR "=========666666666666666666========\n");
        tun0->parms.flags |= (IP6_TNL_F_CAP_XMIT | IP6_TNL_F_CAP_RCV);
printk(KERN_ERR "=========777777777777777777========\n");
        return 0;

        xfrm6_tunnel_deregister(&ip6ip6_handler, AF_INET6);
printk(KERN_ERR "========err pernet=========\n");
        xfrm6_tunnel_deregister(&ip4ip6_handler, AF_INET);
printk(KERN_ERR "========err unreg_ip4ip6=========\n");
printk(KERN_ERR "========err out==================\n");
        return err;


3. How to implement a listiew like Android built-in application Settings.apk

4. How/where to find key used for signing the system.img applications.

5. Alternative keyboard

6. Oot congrazt om hoesin

7. Developing HTC touchflo like inteface for android