Question: I have three tables:  
 `users`:

[![users table](https://i.stack.imgur.com/MWs1d.png)](https://i.stack.imgur.com/MWs1d.png)

`blog`

[![blog table](https://i.stack.imgur.com/86jYu.png)](https://i.stack.imgur.com/86jYu.png)

instagram 

[![instagram table](https://i.stack.imgur.com/oeBhq.png)](https://i.stack.imgur.com/oeBhq.png)

I want to have results from inner join of (users and blog) and (users and instagram) together for which currently I am executing these query  

1.)

```
SELECT instagram.post_author,instagram.post_link,instagram.post_image,instagram.ts,users.username 
from instagram 
INNER JOIN users ON instagram.access_key=users.access_key ORDER BY instagram.ts DESC

```

2.)

```
SELECT blog.content,users.username,blog.ts 
from blog 
INNER JOIN users ON blog.access_key=users.access_key ORDER BY blog.ts DESC

```

I want to combine results from both of these queries but I can't figure out how to.  

p.s: `UNION` **can't** be operated as selected columns are different in number and compatibility.

Answer: 
The issue is you are trying to access the `intent` even before the `onCreate()` is called, as a result `intent` is `null`.

Follow this,

```
    class LocationInfo : AppCompatActivity() {
       private lateinit var longitude:Double
       private lateinit var latitude:Double

        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_location_info)
            btnSaveLocation.setOnClickListener{view ->saveInfo(view)}

             longitude = intent.getDoubleExtra("LONG_DATA",0.0)
             latitude = intent.getDoubleExtra("LAT_DATA",0.0)

           textView2.text = longitude.toString()+"/"+latitude.toString()
        }
        fun saveInfo(x: View?){
            val saveIntent: Intent = Intent(this,MainActivity::class.java)
            startActivity(saveIntent)
        }
    }

```

You should access the `Intent` in the `onCreate()` method.
```
 val longitude = intent.getDoubleExtra("LONG_DATA",0.0)
    val latitude = intent.getDoubleExtra("LAT_DATA",0.0)

```