A
A
andreystrelkov2014-05-05 18:30:31
Python
andreystrelkov, 2014-05-05 18:30:31

How to change the keyboard language used on Android-e?

I bought a mini keyboard for a tablet, now I’m sitting thinking how to make it so that some key or a combination of pressing is programmed to change the language (the tablet has a Hacker keyboard, I didn’t find anything like that in the settings)
Advise a way how to achieve this

Answer the question

In order to leave comments, you need to log in

6 answer(s)
K
Kirill Romanov, 2015-10-29
@Djaler

get_img returns a list and you are trying to use it as a dictionary

A
angru, 2015-10-30
@angru

you should learn python, I have never seen such code at all.

import json
from pprint import pprint
from collections import defaultdict

import requests


BASE_URL = 'http://rt44.ru/rotator.php'


def get_context_ajax(html):
        headers = {
            'Origin': 'http://tovaripohudeniya.ru',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'en-US,en;q=0.8,ru;q=0.6',
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',
            'Accept': '*/*',
            'Referer': 'http://tovaripohudeniya.ru/',
            'Connection': 'keep-alive',
            'Content-Length': '0',
            'Cache-Control': 'max-age=0',
        }

        r = requests.post(html, headers=headers)
        
        if r.ok:
            return json.loads(r.text)
    
        return []


if __name__ == '__main__':
    content = get_context_ajax(BASE_URL)
    img_info = {}

    if content:
        imgs = {item['img_path'] for item in content}

        for item in content:
            img_info[item['bot_text']] = imgs.difference([item['img_path']])

    pprint(img_info)

Of course, if I understand everything correctly, the rest is not needed at all.
PS if this is freelancing - take pity on yourself and the customer, refuse, pull up the python in particular and programming in general.

V
Vladimir Martyanov, 2015-10-29
@vilgeforce

The dictionary does not contain the "'{0}'.format(two)" key, so I suggest that you start debugging your code, at least by printing this unfortunate dictionary before accessing it.

R
Ruslan Ezhgurov, 2015-10-30
@Oyaseo

But in the output I get the first element, everything is ok. And then everything breaks

E
Evgeny Nizamiev, 2014-05-05
@RadiationX

In the language and input settings, there should be this, such as select languages ​​\u200b\u200bfor this keyboard, and then it should show that the keyboard shortcut for changing the layout is CTRL + space

E
Eugene, 2014-05-05
@r4tz52

Put something like External Keyboard Helper Pro , everything is easily configured there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question