股票类app开发怎样玩

手机炒股APP开发的发展模式
手机炒股APP开发的发展模式
夜黑不关注不会怀孕
近期股市出现了大动荡的局面,使得股民迫切想要对股市行情进行深入的研究。移动互联网的发展以及智能手机的普及,使得股市行业APP应运而生,为新一代股民开启移动端的炒股模式。手机炒股APP开发具能够为用户提供实时行情查看、股票预测、目标价格定位评估等功能,不仅能够帮助股民随时随地在线监控股市行情,还能帮助股民通过分析行情,在决定买卖之后完成在线完成交易。与传统方式相比,通过移动端的操作模式能够避免电话委购买的过程中出现占线的情况,同时能够提升证券企业的服务能力以及操作人员的工作效率。手机炒股APP开发拥有最全面、最详细的股票信息,能帮助用户更快的了解市场,为下一步的计划做好准备。用户还可以根据自己不同的需求筛选出自己喜欢的股票进行跟踪。但是股票投资收益大,其相应地需要承受较大的风险,为此手机APP为用户提供添加风控系统功能,就能够精准预测股票的走势,并且提前于是投资的风险,最大程度减少股民朋友可能出现的损失。app开发公司软捷科技:/News/2214.html
本文仅代表作者观点,不代表百度立场。系作者授权百家号发表,未经许可不得转载。
夜黑不关注不会怀孕
百家号 最近更新:
简介: 点下关注又不会让你怀孕
作者最新文章实时获取股票数据的android app应用程序源码分享
作者:Ldlchina
字体:[ ] 类型:转载 时间:
本文我们分享一个实时获取股票数据的android app应用程序源码分享,可以作为学习使用,本文贴出部分重要代码,需要的朋友可以参考下本文
最近学习Android应用开发,不知道写一个什么样的程序来练练手,正好最近股票很火,就一个App来实时获取股票数据,取名为Mystock。使用开发工具Android Studio,需要从Android官网下载,下载地址:。不幸的是Android是Google公司的,任何和Google公司相关的在国内都无法直接访问,只能通过VPN访问。
下图为Android Studio打开一个工程的截图:
下面按步介绍Mystock的实现步骤。
1.以下是activa_main.xml的内容。上面一排是三个TextView,分别用来显示上证指数,深圳成指,创业板指。中间一排是一个EditText和一个Button,用来添加股票。下面是一个Table,用来显示添加的股票列表。
&LinearLayout xmlns:android="/apk/res/android"
xmlns:tools="/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"&
&LinearLayout
android:layout_width="0dp"
android:layout_weight="0.33"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" &
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stock_sh_name"/&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/stock_sh_index"/&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:id="@+id/stock_sh_change"/&
&/LinearLayout&
&LinearLayout
android:layout_width="0dp"
android:layout_weight="0.33"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" &
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stock_sz_name"/&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/stock_sz_index"/&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:id="@+id/stock_sz_change"/&
&/LinearLayout&
&LinearLayout
android:layout_width="0dp"
android:layout_weight="0.33"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center" &
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stock_chuang_name"/&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/stock_chuang_index"/&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:id="@+id/stock_chuang_change"/&
&/LinearLayout&
&/LinearLayout&
&LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="6"
android:id="@+id/editText_stockId"
android:layout_weight="1" /&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_add_label"
android:onClick="addStock" /&
&/LinearLayout&
&!--ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView" /--&
&ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"&
&TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/stock_table"&&/TableLayout&
&/ScrollView&
&/LinearLayout&
应用截图如下:
&2.数据获取,这里使用sina提供的接口来实时获取股票数据,代码如下:
public void querySinaStocks(String list){
// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(this);
String url ="/list=" +
///list=sh600000,sh600536
// Request a string response from the provided URL.
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener&String&() {
public void onResponse(String response) {
updateStockListView(sinaResponseToStocks(response));
new Response.ErrorListener() {
public void onErrorResponse(VolleyError error) {
queue.add(stringRequest);
这里发送Http请求用到了Volley,需要在build.gradle里面添加dependencies:compile 'com.mcxiaoke.volley:library:1.0.19'。
3.定时刷新股票数据,使用了Timer,每隔两秒发送请求获取数据,代码如下:
Timer timer = new Timer("RefreshStocks");
timer.schedule(new TimerTask() {
public void run() {
refreshStocks();
}, 0, 2000);
private void refreshStocks(){
String ids = "";
for (String id : StockIds_){
ids += ",";
querySinaStocks(ids);
&4.在程序退出时存储股票代码,下次打开App时,可以显示上次的股票列表。代码如下。
private void saveStocksToPreferences(){
String ids = "";
for (String id : StockIds_){
ids += ",";
SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(StockIdsKey_, ids);
public void onDestroy() {
super.onDestroy(); // Always call the superclass
saveStocksToPreferences();
5.删除选中的股票,在menu_main.xml里面添加一个action。
&menu xmlns:android="/apk/res/android"
xmlns:app="/apk/res-auto"
xmlns:tools="/tools" tools:context=".MainActivity"&
&item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" /&
&item android:id="@+id/action_delete" android:title="@string/action_delete"
android:orderInCategory="100" app:showAsAction="never" /&
代码响应事件并删除:
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
else if(id == R.id.action_delete){
if(SelectedStockItems_.isEmpty())
for (String selectedId : SelectedStockItems_){
StockIds_.remove(selectedId);
TableLayout table = (TableLayout)findViewById(R.id.stock_table);
int count = table.getChildCount();
for (int i = 1; i & i++){
TableRow row = (TableRow)table.getChildAt(i);
LinearLayout nameId = (LinearLayout)row.getChildAt(0);
TextView idText = (TextView)nameId.getChildAt(1);
if(idText != null && idText.getText().toString() == selectedId){
table.removeView(row);
SelectedStockItems_.clear();
return super.onOptionsItemSelected(item);
屏幕截图:
6.当有大额委托挂单时,发送消息提醒,代码如下:
String text = "";
String sBuy = getResources().getString(R.string.stock_buy);
String sSell = getResources().getString(R.string.stock_sell);
if(Double.parseDouble(stock.b1_ )&= StockLargeTrade_) {
text += sBuy + "1:" + stock.b1_ + ",";
if(Double.parseDouble(stock.b2_ )&= StockLargeTrade_) {
text += sBuy + "2:" + stock.b2_ + ",";
if(Double.parseDouble(stock.b3_ )&= StockLargeTrade_) {
text += sBuy + "3:" + stock.b3_ + ",";
if(Double.parseDouble(stock.b4_ )&= StockLargeTrade_) {
text += sBuy + "4:" + stock.b4_ + ",";
if(Double.parseDouble(stock.b5_ )&= StockLargeTrade_) {
text += sBuy + "5:" + stock.b5_ + ",";
if(Double.parseDouble(stock.s1_ )&= StockLargeTrade_) {
text += sSell + "1:" + stock.s1_ + ",";
if(Double.parseDouble(stock.s2_ )&= StockLargeTrade_) {
text += sSell + "2:" + stock.s2_ + ",";
if(Double.parseDouble(stock.s3_ )&= StockLargeTrade_) {
text += sSell + "3:" + stock.s3_ + ",";
if(Double.parseDouble(stock.s4_ )&= StockLargeTrade_) {
text += sSell + "4:" + stock.s4_ + ",";
if(Double.parseDouble(stock.s5_ )&= StockLargeTrade_) {
text += sSell + "5:" + stock.s5_ + ",";
if(text.length() & 0)
sendNotifation(Integer.parseInt(sid), stock.name_, text);
public void sendNotifation(int id, String title, String text){
NotificationCompat.Builder nBuilder =
new NotificationCompat.Builder(this);
nBuilder.setSmallIcon(R.drawable.ic_launcher);
nBuilder.setContentTitle(title);
nBuilder.setContentText(text);
nBuilder.setVibrate(new long[]{100, 100, 100});
nBuilder.setLights(Color.RED, );
NotificationManager notifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notifyMgr.notify(id, nBuilder.build());
屏幕截图:
以上通过图文并茂的方式给大家分享了一个实时获取股票数据的android app应用程序源码,希望大家喜欢。
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具需求发布后1小时内收到服务商响应每个需求平均有10个服务商参与95%以上的需求得到了圆满解决所有需求不向雇主收取任何佣金双11电商狂欢 爆款服务超乎你想像
一个手机炒股软件app
有相似问题想解决?专业顾问来帮助您
匹配服务商
选择服务商,签单
服务商工作
验收并付款
已投标服务商
综合评分:5颗星
速度:5.00
服务:5.00
态度:5.00
好评率:100%
做过相似案例6个
共有8个服务商参与报价,查看更多服务商报价
参与报价,开始赚钱
提交你的报价和方案
中标后交付作品
获得任务赏金
极速:10分钟急速响应
高品质:精选服务商提供服务
放心:不满意可退款
APP成品套餐
APP成品源码套餐
根据浏览的需求为您推荐
交易成功的需求
APP定制开发相关需求
关注猪八戒微信

我要回帖

更多关于 手机炒股app 的文章

 

随机推荐